development03 /推车/列表视图/ CAT_ID:5
我想收到cat_id,即5.我使用$ this-> params ['catId'])来获取cat_id。但是,我在下面得到了这个错误
注意(8):未定义索引:catId [APP / controllers / categories_controller.php,第384行]
控制器
function getCategoryName() {
Debugger::dump($this->params['catId']);
return $this->Category->find('all', array('conditions'=>array('Category.id' => $this->params['catId'] )));
}
查看
<?php
$categories = $this->requestAction("/categories/getCategoryName");
foreach ($categories as $category) {
echo $category['Category']['name'];
} ?>
有什么想法吗?
答案 0 :(得分:3)