Home  >  Article  >  Backend Development  >  相关session_id

相关session_id

WBOY
WBOYOriginal
2016-06-13 10:48:01704browse

有关session_id
问个问题。

session_id

每关闭一次浏览器,再重新访问的时候,echo session_id()出来,会发现每次的id都不一样。

查了些资料,说跟session.cookie_lifetime = 0有关系,值为0的时候,浏览器关闭则保存于客户端的cookie会被删除掉,于是执行session_start()又要重新去生成一个id。

那我session.cookie_lifetime =9999将其值设为9999,不希望它关闭浏览器就过期,为什么重新打开浏览器仍然生成的session_id是不一样呢?

------解决方案--------------------
echo ini_get("session.cookie_lifetime");确保有效了?

另外,就算9999,GC还是会清理设定gc_maxlifetime的过期session文件的

Statement:
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