I'm using C开发者_运维问答odeIgniter, and I'm having a small issue with sessions. I've set 'sess_expiration' in config.php to 0 so that the user session will never expire, yet users -even myself- are still occasionally kicked out and asked to login again! (i'm storing sessions in the DB btw)
The way I validate a user's session is by basically checking if user_id (which I've previously stored in the session is TRUE or FALSE. If it's FALSE then it asks them to login again.
Any idea what could be forcing sessions to expire?
Appreciate your help :)
If you're making AJAX requests in your app/site I think this may be the issue you are experiencing: https://github.com/EllisLab/CodeIgniter/issues/154
It seems to be a bug in how CI handles AJAX requests updating sessions.
Try setting the session expire to some really large number. Try:
time()+(3600*24*365*5)
or
time()+157680000;
This session should last you 5 years.
精彩评论