我在會議上添加訂單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.
}
還附加了重定向前的快照。
你在控制器的開始做的session_start? –