已传递的第一个数组,其值可以输出,而第二个数组产生错误.. 我们尝试在两个数组上使用 print_r 命令,它包含一个值
这是我们尝试过的
控制器
$project['project'] = (call model with return value);
$amenity['amenity'] = (call model with return value);
$data['project'] = $project;
$data['amenity'] = $amenity;
$this->load->view('view.php', $data);
看法
//this code works
foreach($project is $i){
echo 'title: '.$i[0]->title;
}
//this code produce error, undefined object $amenity
foreach($amenity is $j){
echo 'amenity: '.$j[0]->amenity;
}