$categ = $this->FreeadsCategory->bindModel(array('hasMany' => array('Subcategory' => array('foreignKey' => 'category_id', 'order'=>'id ASC') ) ) ;
$data = $this->FreeadsCategory->findById($i); $this->set("数据", $data);
- 我无法使用 cakephp 获取视图页面中的数据
- 如果我给 pr($datas); ctp文件什么都不显示
- 如果我在控制器中打印数据,我将得到以下数组结构
数组([FreeadsCategory] => 数组([id] => 1 [uuid] => 51512434-e4c4-441b-b90e-16f8732d5573 [类别] => 汽车 [状态] => 活动)
[Subcategory] => Array
(
[0] => Array
(
[id] => 1
[uuid] => 4ea15f22-adf0-4020-b35d1-052ff9ff9a27
[category_id] => 1
[subcategory] => Cars/Cabs/Jeeps
[status] => Active
)
[1] => Array
(
[id] => 5
[uuid] => 51cec363-e7ac-4095-a86b-0ccdf260d1b4
[category_id] => 1
[subcategory] => Buses/Lorries
[status] => Active
)
)