2013-09-30 113 views
3

enter image description here笨會議摧毀後重定向

我在會議上添加訂單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. 
} 

還附加了重定向前的快照。

+0

你在控制器的開始做的session_start? –

回答

4

什麼是 應用程序配置/配置/ config.php文件

如果 $配置[ 'sess_use_database'] = FALSE;

這意味着您將會話信息存儲在Cookie中,限制爲4kb。 可能是這個問題。將大量數據存儲在數據庫中。

http://ellislab.com/codeigniter/user-guide/libraries/sessions.html

+0

我從會話中取消了一些數據。現在工作正常。 –

1

請刪除以下行,並嘗試

$this->load->model('customer_model'); 
+0

我試過這個,但沒有工作。什麼是刪除這個邏輯? –

0

我有同樣的問題,並通過禁用檢查會話用戶代理解決它:

$config['sess_match_useragent']=FALSE