php中session过期时间设置_PHP教程

WBOY
Release: 2016-07-13 17:50:23
Original
916 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销毁了,此时你也就处于登出的状态了!



第零空间版权所有

www.bkjia.com true http://www.bkjia.com/PHPjc/478261.html TechArticle 当我们用session保存了用户的登录信息之后,如果用户没有选择点击登出按钮而是选择了直接关闭浏览器,那在服务器端保存的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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!