在路径文件中使用Model,cakephp [英] Using Model in routes file, cakephp
本文介绍了在路径文件中使用Model,cakephp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在我的/app/Config/routes.php配置文件中从我的数据库加载值。
I am looking to load values from my database in my /app/Config/routes.php configuration file.
在顶部,我使用: App :: uses('Option','Model');
我在我的类中调用我的find: code> $ this-> Option-> find('all');
And I am calling my find in my class: $this->Option->find('all');
p>
推荐答案
我认为您必须在使用之前实例化模型:
I think you have to instantiate the model before you use it:
App::uses('Option', 'Model');
$option = new Option();
$something = $option->find('all');
这篇关于在路径文件中使用Model,cakephp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文