开发者

How to get the names of all the models in Zend Framework

i'm just wondering how can you return the names of the models you've creat开发者_JAVA百科ed inside your models folder?


Due to the fact the models are loaded using the autoloader, the only way you are going to be able to do it is to use something like the DirectoryIterator or glob() to get a list of the PHP files in the models directory as there is no guarantee that all or any of the models are loaded.


same as above but a little tweak, Create a helper class to fetch all classes inside the model folder by using the directory iterator then append "Model_" at the beginning of each result to get the actual model name. This may fail given additional directories inside the model folder.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜