我在会话中添加订单ID和购物车项目.如果我在会话中添加2个购物车项目.它工作正常.如果我在会话中添加3个或更多项目的购物车.重定向丢失后的所有数据.
控制器的名称是结帐.
function pay_order($order_id){
$this->load->helper('url');
$this->load->library('session');
$this->load->library('cart');
$this->load->helper('url');
$this->load->helper('form');
$output = $this->cart->contents();
$output = $this->sort_array($output);
$list['data'] = $output;
$list['order_id'] = $order_id;
$this->session->set_userdata('ses', $list);
echo '<pre> Session Before Redirect';
print_r($this->session->userdata('ses'));// all data present.
redirect('checkout/do_payment');
}
function do_payment(){
$this->load->helper('url');
$this->load->helper('url');
$this->load->library('session');
$this->load->library('cart');
$this->load->helper('url');
$this->load->helper('form');
$this->load->library('session');
$this->load->model('customer_model');
echo 'After redirect<pre>';
print_r($this->session->userdata('ses'));// does not get any data here.
}
还附加了重定向之前的快照.
解决方法:
如果是
$config [‘sess_use_database’] = FALSE;
这意味着您将会话信息存储在cookie中,限制为4kb.
可能这就是问题所在.将大量数据存储在数据库中.
http://ellislab.com/codeigniter/user-guide/libraries/sessions.html