2

development03/carts/listview/cat_id:5

我想接收 cat_id,即 5。我正在使用 $this->params['catId']) 来获取 cat_id。但是,我在下面收到此错误

注意(8):未定义索引:catId [APP/controllers/categories_controller.php, line 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'];
} ?>

有任何想法吗?

4

1 回答 1

3

我想你正在寻找$this->params['named']['catId']

编辑:

显然,在 cakephp 1.2 中,它是$this->passedArgs['catId']

文档

于 2012-07-18T01:17:04.780 回答