我想在Codeigniter中動態設置會話過期時間。我自動加載會話課程。我有一個包含用戶點擊複選框的視圖(請記住我)。如果他們點擊複選框,或者不是現在的到期時間保持不變:/幫助w/Codeigniter會話過期時間
// Config.php
$config['sess_expiration'] = 7200;
// Controller
if ($this->input->post('remember_me') == 'TRUE')
{
$this->session->remember_me();
}
$newdata = array(
'failed_login' => 0,
'user_name' => $this->input->post('user_name'),
'logged_in' => TRUE
);
$this->session->set_userdata($newdata);
// MY_Session.php
class MY_Session extends CI_Session {
function remember_me()
{
$this->sess_expiration = 172800;
}
}