检索php服务器会话超时 [英] retrieve php server session timeout

查看:39
本文介绍了检索php服务器会话超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从 PHP 服务器设置中检索 session.gc_maxlifetime 的值(没有活动后会话过期的时间).非常重要:我不想更改它,我只想检索它的值(可能值因服务器而异)并且我想使用我制作的 PHP 脚本来正确警告用户,具体取决于设置那些服务器.

I want to retrieve the value of session.gc_maxlifetime from the PHP server settings ( the time after which the session expires after no activity ). Very important : I do not want to change it, I only wish to retrieve its value ( maybe the value is different from server to server ) and I want to use a PHP script that I made to warn users properly, depending on the settings of those server.

谢谢.

推荐答案

这就是 ini_get 函数派上用场的地方:

That's where ini_get function comes in hand:

$maxlifetime = ini_get("session.gc_maxlifetime");

我们从手册中读到:

session.gc_maxlifetime 整数session.gc_maxlifetime 指定数据将被视为垃圾"并可能被清理的秒数.会话开始期间可能会发生垃圾收集(取决于 session.gc_probability 和 session.gc_divisor).

session.gc_maxlifetime integer session.gc_maxlifetime specifies the number of seconds after which data will be seen as 'garbage' and potentially cleaned up. Garbage collection may occur during session start (depending on session.gc_probability and session.gc_divisor).

这篇关于检索php服务器会话超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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