如何将多维度数组传递给视图?控制器代码
public function index(){
data['navs'] = array(
'name' => array('one', 'two', 'three'),
'link' => array('one', 'two', 'three'));
$this->load->view('adminView', $data);}
查看代码
<?php if ($navs) {
foreach ($navs as $nav) {
echo('<li><a href="' . $nav->link . '">' . $nav->name . '</a></li>');
}
}?>