Kürzlich habe ich ein Problem, ein Projekt zu tun.Mehrdimensionale Daten zur Seite in CodeIgniter übergeben
Die Controller Seite
if ($result -> num_rows() ==1) {
$info['stu_data']=array();
$i=0;
$rs= $this -> db -> query ($this -> User_model -> view_action());
if ($rs -> num_rows() > 0) {
foreach ($rs -> result() as $rows) {
$info [$i]['stu_name'] = $rows -> stu_name;
$info [$i]['username'] = $rows -> username ;
$info [$i]['roll'] = $rows -> roll ;
$info [$i]['password'] = $rows -> password ;
$info [$i]['first'] = $rows -> first;
$info [$i]['second'] = $rows -> second ;
$info [$i]['third'] = $rows -> third;
$info [$i]['fourth'] = $rows -> fourth;
$info [$i]['fifth'] = $rows -> fifth ;
$i++;
}
}
//$data['data']=$this -> User_model -> view_action();
//print_r($info);
$this -> load -> view ('add',$info);
}
und die Aussicht Seite ist
<?php
var_dump($stu_data);
?>
Aber ich in der add.php Seite hätte Kenntnis nehmend. Aber der Wert von $ info Variable auf der Controller-Seite wird in Ordnung sein.
Bitte lösen Sie dieses Problem.
'$ info ['stu_data'] = array();' folglich ist $ stu_data' gleich leer Array – splash58