All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
PHP中的session的几个问题_php资料_编程技术

Writer: aaa Article type: Programming skills(编程技巧) Time: 2013/12/21 22:24:59 Browse times: 408 Comment times: 0

PHP中的session的几个问题_php资料_编程技术


Head photo

Go homepage
Upload pictures
Write articles

PHP中的session的几个问题_php资料_编程技术-你的首页-uuhomepage.com
session 的生命周期是多长
1 浏览器结束时其生命周期也同时结束,但是档案仍然存在于 /tmp/(sess_???)
2 下次重新开浏览器时会重新分配 sessionID,如果你使用 session_id() 把以前的 ID 带回来,则会去读取残存在 /tmp 处的 sess_???, 取回你之前所有已经设定的参数
3 可以在 php.ini 里修改 session 档案残存的时间

session.gc_maxlifetime = 1440 ; after this number of seconds, stored
data will be seen as 'garbage' and
cleaned up by the gc process

默认是 1440 秒,24分钟

使用 session 注意的存储路径问题

看看 php.ini 里对于 session 的设置

[Session]
session.save_handler = files ; handler used to store/retrieve data
session.save_path = /tmp ; argument passed to save_handler
in the case of files, this is the
path where data files are stored

默认是存于 /tmp 目录下,这个目录可不一定真有啊!!! 最好改为你的 php 安装路径,比如 c:/php




There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.