PHP会话默认是否有超时 - 也就是说,如果我没有进行任何编码,用户在长时间不活动后是否会被"注销"?
PHP会话默认情况下具有超时功能,这意味着如果用户长时间未活动,则会自动将其注销。可以通过更改会话超时设置来调整此行为。这取决于服务器配置或相关指令 php.ini中的session.gc_maxlifetime。
通常默认为24分钟(1440秒),但您的网络主机可能已将默认值更改为其他数值。
你可以在你的 web 服务器上的 php 配置中更改它。
在 php.ini
中搜索
session.gc_maxlifetime()
该值以秒为单位设置。
是的,通常情况下会在1440秒(24分钟)后发生这种情况。
http://php.net/session.gc-maxlifetime
session.gc_maxlifetime = 1440
(1440 seconds = 24 minutes)
session.gc_maxlifetime = 1440
; NOTE: If you are using the subdirectory option for storing session files
; (see session.save_path above), then garbage collection does *not*
; happen automatically. You will need to do your own garbage
; collection through a shell script, cron entry, or some other method.
; For example, the following script would is the equivalent of
; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes):
; find /path/to/sessions -cmin +24 -type f | xargs rm