Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在 Yii 中创建一个控制器,它返回用户会话剩下多少秒。每次用户在我的页面上做某事时,超时都会被重置,它应该被重置。但我的问题是两件事。
如果设置allowAutoLogin为 true,则必须指定用户会话的持续时间作为login()函数的第二个参数。在这种情况下,您已经存储了登录时间的时间戳并计算了差异。
allowAutoLogin
login()
如果allowAutoLogin为假,您必须获取会话超时ini_get('session.gc_maxlifetime'),然后存储它并向用户显示差异。
ini_get('session.gc_maxlifetime')