通过 .htaccess 在 PHP 中扩展会话超时 [英] Extending session timeout in PHP via the .htaccess

查看:16
本文介绍了通过 .htaccess 在 PHP 中扩展会话超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想延长我的用户保持登录状态的时间,而不会在一段时间不活动后自动退出.我正在使用 PHP 会话跟踪登录状态.

I want to up the time my users will stay logged into my site without getting automatically logged out after a period of inactivity. I'm tracking the logged in status using PHP sessions.

我该如何设置,我正在尝试从我的 .htaccess 文件中控制它.

How can I set this, I'm trying to control this from my .htaccess file.

推荐答案

你不能从 htaccess 文件中这样做,但是你可以在你的 php.ini 中改变这一行代码>文件.

You can't do that from the htaccess file but You can change this line in your php.ini file.

session.gc_maxlifetime = 1440

更新:这似乎是可能的,所以我纠正了

Update: it seems to be possible, so i stand corrected

php_value session.gc_maxlifetime 3600

不过我还没试过.

这篇关于通过 .htaccess 在 PHP 中扩展会话超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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