2014-05-23 26 views

回答

2

Set_cookie來自幫手。你不需要喲使用$這 - >會話,它僅僅是一個函數:

$this->load->helper('cookie'); 
set_cookie('pname',$this->input->post('type')); 
+0

文森特Decaux..Thanks .. :)你節省我的時間...... –

0

cookie的助手提供了友好的語法,但更好的方法是不加載它,只是使用Input Class,這是自動加載。

$cookie = array(
    // Required parameters 
    'name' => 'pname', 
    'value' => $this->input->post('type'), 
    // Optional parameters 
    //'expire' => '86500', 
    //'domain' => '.some-domain.com', 
    //'path' => '/', 
    //'prefix' => 'myprefix_', 
    //'secure' => TRUE 
); 

$this->input->set_cookie($cookie); 

或者使用離散參數:

你可以通過一個數組做到這一點

$this->input->set_cookie('pname', $this->input->post('type')); 
+0

感謝Lefters .. :) –

相關問題