Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在 CakePHP 的 TitleController 中向 UserController 发出请求?
我试试
$ this-> User-> Title-> find ('list');
但它不起作用。
如果您的 User 模型和 Title 模型之间存在 HasMany 或 BelongsTo 等关系,您将能够使您的代码工作。如果没有关系,则需要先加载模型:
在您的标题控制器中:
$this->loadModel('User'); $this->User->find('list');