我想在我的表格中显示来自$ result的所有数据,但是有一些错误
通知是"数组到字符串转换"
这是控制器:
public function actionIndex()
{
$command = Yii::app()->db->createCommand('
Select username as user
From application_admin aa, application a
Where a.app_id = aa.app_id');
$reader = $command->query();
$dataUser = $reader->readAll();
$dataProvider = Application::model()->findAll();
foreach ($dataProvider as $data) {
$temp = array();
$name = $data->name;
$customer = $dataUser;
$category = $data->appCategory->name;
$temp['name'] = $name;
$temp['customer'] = $customer;
$temp['category'] = $category;
$result[] = $temp;
}
$this->render('index',array('result'=>$result));
}
这是视图:
<?php
$i=1;
foreach ($result as $data){
?>
<tr class="center clickableRow">
<div>
<td><?php echo $i; ?></td>
<td><?php echo $data['name']; ?></td>
<td><?php echo $data['customer'];?></td> //error in this line
<td><?php echo $data['category'];?></td>
</div>
</tr >
<?php
$i++;
}
?>
请给我一些建议,谢谢
答案 0 :(得分:0)
最后我明白了
<td><?php echo $data['customer']['user'];?></td>
感谢所有