过去 1 年进行登录会话 [英] Making login session last 1 year
本文介绍了过去 1 年进行登录会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望我网站的登录会话能够持续很长时间,比如一年.我的索引文件中有以下代码.
I want my website's login session to last a long time, like a year. I have the code below on my index file.
问题是,我在大约 30 分钟不活动后退出了我的网站.
The problem is, I'm logged out of my site after about 30 minutes of inactivity.
如何让我的登录会话保持过去 1 年?
How can I make my login session last 1 year?
session_set_cookie_params(31536000, '/', 'www.domain.com');
session_start();
此外,我的 php.ini 文件中有此代码:
Also, I have this code on my php.ini file:
session.gc_maxlifetime = 31536000
session.cookie_lifetime = 31536000
推荐答案
编辑您的 .htaccess 文件以添加这一行 ....
edit your .htaccess file to add this line ....
php_value session.gc_maxlifetime 31536000
31536000 是以秒为单位的一年
31536000 being a year in seconds
这篇关于过去 1 年进行登录会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文