PHP:会话的默认生存期是多少 [英] PHP : What is the default lifetime of a session

查看:118
本文介绍了PHP:会话的默认生存期是多少的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我点击了调用session_start()的页面.我需要等待多长时间,以便刷新页面时获得新的会话ID?

If i hit a page which calls session_start(). How long would I have to wait, so that if i was to refresh the page, I was issued a new session ID?

推荐答案

检出php.ini,为session设置的值.gc_maxlifetime是ID生存时间(以秒为单位).

Check out php.ini the value set for session.gc_maxlifetime is the ID lifetime in seconds.

我相信默认值为1440秒(24分钟)

I believe the default is 1440 seconds (24 mins)

http://www.php.net/manual/en/session. configuration.php

编辑:正如一些评论所指出的那样,上述内容并不完全正确.有关为什么以及如何实现会话生存期的精彩说明可在此处找到:

As some comments point out, the above is not entirely accurate. A wonderful explanation of why, and how to implement session lifetimes is available here:

如何在30分钟后使PHP会话到期分钟?

这篇关于PHP:会话的默认生存期是多少的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆