我想将数据从多维数组保存到codeigniter 2中的flashdata会话中。x
foreach($value->result as $val){}
if($val->somethinghappenedtrue){
$arr[] = array('data' => $thethingthathappened);
}
}
$this->session->set_flashdata($arr);
数组应该是
[0]
'data' => 'thing1'
[1]
'data' => 'thing2'
[3]
'data' => 'thing3'
[4]
'data' => 'thing4'
i have been try access is by
echo "<pre>";
print_r($this->session->flashdata('arr'));
echo "</pre>";
和
echo "<pre>";
print_r($this->session->flashdata('data'));
echo "</pre>";
这样它将打印与上面显示的完全相同的数组但是屏幕上什么也不显示
试试这个
foreach($value->result as $val){}
if($val->somethinghappenedtrue){
$arr[] = $thethingthathappened;
}
}
$this->session->set_flashdata('data',$arr);
echo "<pre>";
print_r($this->session->flashdata('data'));
echo "</pre>";
结果如下
数组([0] [au:[1] [au:[2] [au:)