开发者

PHP custom session mechanism - and cookie expire problem

开发者 https://www.devze.com 2023-03-14 01:06 出处:网络
I\'m using session_set_save_handler() to keep my session in Redis, and everything works perfectly, except one thing.

I'm using session_set_save_handler() to keep my session in Redis, and everything works perfectly, except one thing. after hours and hours of pulling my hair I thought I should开发者_开发技巧 just ask someone. so, on the server side, I set the session life for X minutes. on each page refresh, the session life is set to X minutes, but on the browser the cookie expires after exactly 30 minutes after the first page load. how can I force the cookie life to be extended on each page refresh like on the server side. any thoughts?


Try something like:

session_start();
setcookie(session_name(), session_id(), strtotime('NOW+30MINUTES'));
0

精彩评论

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