Does anyone know if there's a simple way to retrieve the list of models in cakePHP v1.1? For example, if the app has models Student, Teacher, and Grade, I'm looking for a way to get an array of these models. Any suggestions? Thank you much.
2条回答 默认 最新
- dtn36013 2012-08-31 19:10关注
It looks like the best way to do this is to simply check which files exist in the models directory and check if they contain a class. I've decided that this is the best method based on the fact that this is essentially what the loadModel() function does itself. The code for the loadModel() function can be found here. The program I ended up not needing to get the list of all models, but hopefully this answer can steer people in the right direction if anyone does need such a list.
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报