Codeigniter:用户会话不断过期 [英] Codeigniter: User session keeps expiring

查看:77
本文介绍了Codeigniter:用户会话不断过期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用CodeIgniter,并且会话遇到一个小问题。我已将config.php中的 sess_expiration设置为0,以使用户会话永不过期,但用户-甚至我本人-仍然偶尔会被踢出并要求再次登录! (我将会话存储在数据库中)

I'm using CodeIgniter, 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)

我验证用户会话的方式是基本上检查user_id(我之前存储在会话中的

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?

感谢您的帮助:)

推荐答案

尝试将会话设置为一个非常大的数目。尝试:

Try setting the session expire to some really large number. Try:

time()+(3600*24*365*5)

time()+157680000;

本次会议应该持续5年。

This session should last you 5 years.

这篇关于Codeigniter:用户会话不断过期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆