我的会议将持续多久? [英] How long will my session last?

查看:25
本文介绍了我的会议将持续多久?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以通过下面的数据告诉我我的会话将持续多久吗?- 我不确定是哪一个告诉我

Can someone please tell me how long my session will last from the data below? - I'm not sure which one tells me

session.auto_start  Off Off
session.bug_compat_42   Off Off
session.bug_compat_warn On  On
session.cache_expire    180 180
session.cache_limiter   nocache nocache
session.cookie_domain   no value    no value
session.cookie_httponly Off Off
session.cookie_lifetime 0   0
session.cookie_path /   /
session.cookie_secure   Off Off
session.entropy_file    no value    no value
session.entropy_length  0   0
session.gc_divisor  1000    1000
session.gc_maxlifetime  1440    1440
session.gc_probability  1   1
session.hash_bits_per_character 5   5
session.hash_function   0   0
session.name    PHPSESSID   PHPSESSID
session.referer_check   no value    no value
session.save_handler    files   files
session.save_path   /var/lib/php/session    /var/lib/php/session
session.serialize_handler   php php
session.use_cookies On  On
session.use_only_cookies    Off Off
session.use_trans_sid   0   0

推荐答案

一般可以说 session.gc_maxlifetime 指定自上次更改会话数据(不是最后一次session_start 被调用!).但是 PHP 的会话处理稍微复杂一些.

In general you can say session.gc_maxlifetime specifies the maximum lifetime since the last change of your session data (not the last time session_start was called!). But PHP’s session handling is a little bit more complicated.

因为会话数据被一个垃圾收集器移除了,这个垃圾收集器只被session_start 概率为 session.gc_probability会话划分.gc_divisor.默认值为 1 和 100,因此垃圾收集器仅在所有 session_start 调用的 1% 中启动.这意味着即使会话理论上已经超时(会话数据已更改超过 session.gc_maxlifetime 秒前),会话数据可以使用更长的时间.

Because the session data is removed by a garbage collector that is only called by session_start with a probability of session.gc_probability devided by session.gc_divisor. The default values are 1 and 100, so the garbage collector is only started in only 1% of all session_start calls. That means even if the the session is already timed out in theory (the session data had been changed more than session.gc_maxlifetime seconds ago), the session data can be used longer than that.

因此,我建议您实现自己的会话超时机制.请参阅我对如何的回答我如何在 30 分钟后使 PHP 会话过期? 了解更多详情.

Because of that fact I recommend you to implement your own session timeout mechanism. See my answer to How do I expire a PHP session after 30 minutes? for more details.

这篇关于我的会议将持续多久?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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