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 的初学者,
我想知道我如何在控制器的操作中做到这一点:
$this->Image->Category->findAllByRewrite($category_rewrite);
我想获取该类别的所有图像..
谢谢 !
我可能不能 100% 确定您在问什么,但是如果您在 ImagesController 中添加它,那么您就在正确的轨道上。我认为您不需要像您所指示的那样链接 Category 模型。
你会做这样的事情:
$category_id = $value; $images = $this->Image->find('all', array('conditions' => array('Image.category_id' => $category_id)));
通过更多澄清,我可以更改此响应。