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

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

问题描述

如果我打出一个调用session_start()的页面,刷新页面时我需要等待多长时间才能获得新的会话ID?

If I hit a page which calls session_start(), how long would I have to wait before I get a new session ID when I refresh the page?

推荐答案

检查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会话到期分钟?

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

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