开发者

How can I set a logged in session to be remembered for 2 weeks in CodeIgniter?

开发者 https://www.devze.com 2023-01-04 17:28 出处:网络
If a user logs in and 开发者_JS百科selects \"Remember me for 2 weeks\", I want the session to remember them for 2 weeks. If not, it should expire in 2 hours. How do I do this?//if variable two_weeks i

If a user logs in and 开发者_JS百科selects "Remember me for 2 weeks", I want the session to remember them for 2 weeks. If not, it should expire in 2 hours. How do I do this?


//if variable two_weeks is set, set session expiration to 2 weeks; otherwise 2 hours  
($two_weeks)?$t='1209600':$t='7200');
$this->session->set_userdata('sess_expiration',$t);
0

精彩评论

暂无评论...
验证码 换一张
取 消