怎么将PHP中SESSION部分数据保存

WBOY
Release: 2016-06-13 13:24:08
Original
764 people have browsed it

如何将PHP中SESSION部分数据保存

上次别人给了我一个单子,要将PHP中SESSION部分数据保存,但是问题是总有个过期不能处理,这里介绍一下session的过期设置:


在PHP中,设置php.ini,找到session.gc_maxlifetime = 1440 #(PHP5默认24分钟)

这里你可以随便设置一下过期时间.但是有人说设置以后,好象不起作用!

其实不是不起作用,而是因为系统默认:

session.gc_probability = 1

session.gc_divisor = 1000

garbage collection 有个概率的,1/1000就是session 1000次才有一次被回收。

只要你的访问量大了,那就能达到回收的效果.

要不然你也可以设置一下session.gc_divisor 的值,

比如:session.gc_divisor = 1,这样就能明显的看到SESSION过期的效果了.(龙铭洪)

Related labels:
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 Tutorials
More>
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!