本文介绍了会话超时在PHP代码和htaccess中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们用来在php中设置会话超时的内容.我发现了以下内容:
What we use to set the session time out in php. I found following:
ini_set(session.cookie_lifetime, 3600); ini_set(session.gc_maxlifetime, 3600);在php中设置会话超时是正确的方法吗?还是有什么方法可以在htaccess文件中设置超时时间?
Is it right way to set timeout for session in php? Or is there any way we can set the time out in htaccess file?
也许这是一个简单的问题,但我并没有真正的答案,甚至在SO,Google和php上也尝试过,但没有直接的解决方案或代码.
Maybe its a simple question, but I am not really able to get the answer, even tried on SO, Google and php but no straight solutions or code for this.
推荐答案我已通过在.htaccess文件中添加以下代码来解决此问题.
I have resolved this issue by adding following code in my .htaccess file.
<IfModule mod_php5.c> #Session timeout php_value session.cookie_lifetime 1200 php_value session.gc_maxlifetime 1200 </IfModule>谢谢!
更多推荐
会话超时在PHP代码和htaccess中?
发布评论