会话超时在PHP代码和htaccess中?

编程入门 行业动态 更新时间:2024-10-23 05:43:13
本文介绍了会话超时在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中?

本文发布于:2023-10-31 16:28:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546633.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:代码   PHP   htaccess

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!