开发者

Dynamic Enumeration in PHP. Possible? Sensible?

I am building an API which will accept a variety of metrics from an iPhone application.

The App Programmer has requested that the API be able to handle types of metrics the API does not yet know about. I would like to use an enumeration to list the current t开发者_StackOverflow中文版ypes of Metrics, but new metrics would have to be added as they are pushed to the server.

Has anyone seen this done before? I've thought about using a DB instead of an enum, but that seems really messy.

Any thoughts?


Don't use an enumeration. Enumerations are primarily useful for when the entire range of values is known ahead of time; this is clearly not your case.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜