我在会话中添加订单 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.
}
还附加了重定向之前的快照。