更新时间:2022-05-26 01:20:02
在 app/config/session.php
你有:
生命周期
允许您以分钟为单位设置会话过期时间的选项
option that allow you to set session expire time in minutes (not in seconds)
'lifetime' => 60,
表示会话将在一个小时后过期.
means that session will expire after an hour.
这里还有一个设置:
'expire_on_close' => true,
决定当浏览器关闭时会话是否过期.
that decides if session will be expired when browser will be closed.
您可能感兴趣的其他设置还有 php.ini
值:
Other settings you could get interested is also php.ini
values of:
session.cookie_lifetime = 0
和
session.gc_maxlifetime = 1440
这些是默认值.
第一个表示会话 cookie 将存储多长时间 - 默认值为 0(直到浏览关闭).第二个选项表示在多少秒之后 PHP 可能会破坏此会话数据.
The first one means how long session cookie will be stored - default value is 0 (until browse is closed). The second option means after how many of seconds PHP may destroy this session data.
我说可能是因为在 php.ini
文件中有另一个选项 session.gc_probability
决定了运行垃圾收集器的机会.默认情况下,只有 1% 的机会在 1440 秒(24 分钟)后此会话数据将被销毁.
I said may because there is one other option session.gc_probability
in php.ini
file that decides what's the chance of running garbage collector. Be default there is only 1% chance that after 1440 seconds (24 minutes) this session data will be destroyed.