Home > php教程 > php手册 > php中session过期时间设置

php中session过期时间设置

WBOY
Release: 2016-06-13 10:49:00
Original
1141 people have browsed it

当我们用session保存了用户的登录信息之后,如果用户没有选择点击登出按钮而是选择了直接关闭浏览器,那在服务器端保存的session是否会长期存在呢?
 
答案是否定的!因为SESSION存在一个过期时间。如果session上一次修改的时间距离当前之间超过某个值的话,这个session将会被清除!
 
在php的配置文件php.ini中有这么个选项:
 
; After this number of seconds, stored data will be seen as 'garbage' and
 
; cleaned up by the garbage collection process.
 
session.gc_maxlifetime = 1440 www.2cto.com
 
也就是如果超过24分钟没有访问网站的话,服务器就把你的SESSION销毁了,此时你也就处于登出的状态了!
 
 
 
第零空间版权所有

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template