什么是在PHP中默认的会话过期时间? [英] What is the default session expiration time in PHP?

查看:100
本文介绍了什么是在PHP中默认的会话过期时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有坪数据库​​每分钟左右,以检查是否有新项目的Web应用程序。该网页的设计不是真的有......你只要保持开放,并显示任何东西互动。该页面有密码保护,而网站可以达到一个轿跑车天没有任何人点击Web浏览器或任何东西。我发现后,它是由像一天左右停止检查数据库(通过一个Ajax请求),然后如果您手动刷新页面它带给你的登录页面了。我猜想这是因为它具有的登录信息会话过期。我从来没有设置过期时间,但是PHP在一定时间后自动销毁的会议?我该怎么做才能解决这个问题?

I have a web application that pings a database every minute or so to check for new entries. The page is designed to not really have any interaction with... You just keep it open and it displays things. The page is password protected, and the site can be up for a coupe days without anyone clicking in the web browser or anything. I've found after it's up for like a day or so it stops checking the database (through an Ajax request) and then if you refresh the page manually it brings you to the login page again. I'm assuming that's because the session which has the login information expires. I never set an expiration time, but does PHP automatically destroy the sessions after a certain amount of time? What do I do to fix this?

感谢

感谢所有的答复...有没有一种方法来设置会议,从不与出过期只是改变了PHP设置自己呢?

Thanks for all the replies... Is there a way to set the session to never expire with out just changing the PHP settings themselves?

推荐答案

的<一个默认值href="http://php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime">session.gc_maxlifetime为1440秒。因此,垃圾收集器假设一个会话过期时,最后一个修改是至少1440秒前。

The default value of session.gc_maxlifetime is 1440 seconds. So the garbage collector assumes a session to be expired when the last modification was at least 1440 seconds ago.

请注意,使用一个Cookie的会话ID时,它可能有不同的一生。默认值为 0 中的 session.cookie_lifetime 的地使Cookie会话cookie,这意味着它到期的浏览器会话结束时(即浏览器关闭)。

Note that when using a cookie for the session ID it might have a different lifetime. The default value 0 of session.cookie_lifetime makes the cookie a session cookie, that means it expires when the browser session is ended (i.e. the browser is closed).

另请参见<一个href="http://stackoverflow.com/questions/520237/how-do-i-expire-a-php-session-after-30-minutes/1270960#1270960">my回答的如何在30分钟后过期一个PHP会议?的对会话过期的详细信息。

See also my answer on How do I expire a PHP session after 30 minutes? for further information on session expiration.

这篇关于什么是在PHP中默认的会话过期时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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