//控制器
social account type
//查看
public function viewcategorys1() {
$this->loadModel("Category");
$total = $this->Category->find('all', array('fields' =>array('sum(Category.rate) AS ctotal'), 'conditions'=>array('Category.parentid' => 0)));
$this->set('sum',$total);
print_r($total);
}
在控制器中我写了'print_r',因此它显示为put:
<?php
foreach($sum as $ctotal):
echo $ctotal['Category']['rate'];
endforeach;
?>
根据视图文件中编写的代码,它显示输出为:
Array ( [0] => Array ( [0] => Array ( [ctotal] => 16250 ) ) )
如何在view.ctp文件中打印值16225? 请帮帮我