简体   繁体   English

PHP会话变量超时

[英]PHP Session variable timeout

My application uses some session variables that are timing out even though I thought they would not because I've got the following setting in php.ini: 我的应用程序使用了一些超时的会话变量,尽管我认为它们不会,因为我在php.ini中具有以下设置:

session.cookie_lifetime = 0 session.cookie_lifetime = 0

The other session settings in php.ini are pretty much set as their defaults. php.ini中的其他会话设置几乎都设置为默认值。 How do I make sure the session variables stay around until the browser window closes? 如何确保会话变量一直存在直到浏览器窗口关闭?

我认为您使用session.gc_maxlifetime设置了会话超时,默认为1440秒-24分钟

Note that since PHP 4.2.3 the life time is calculated on the base of the modification date and not the access date (see session.gc_maxlifetime ). 请注意,自PHP 4.2.3起,生命周期是根据修改日期而不是访问日期计算的(请参阅session.gc_maxlifetime )。 So you have to update the session data on every request to “reset the timer”. 因此,您必须针对每个请求更新会话数据以“重置计时器”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM