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

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

问题描述

如果我点击了一个调用 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.配置.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天全站免登陆