php – Laravel 7 Session Lifetime
  TEZNKK3IfmPf 2023年11月14日 81 0
php

根据Laravel config / session.php

/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/

'lifetime' => 120,
'expire_on_close' => true,
'expired-session-redirect' => url(env('APP_URL'))

我已将会话的生命周期设置为120分钟,但我感觉我的用户在120分钟之前已注销.

这是一个错字吗?它们意味着120秒,即2分钟?

任何人都可以对此有所了解吗?

检查你的php.ini:

session.gc_maxlifetime – 默认1440秒 – 24分钟

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).

session.cookie_lifetime – 默认值0

session.cookie_lifetime specifies the lifetime of the cookie in seconds which is sent to the browser. The value 0 means “until the browser is closed.” Defaults to 0. See also session_get_cookie_params() and session_set_cookie_params().

如果它的时间少于Laravel配置,则cookie将被删除,因为本地php.ini优先于Laravel配置.

你可以增加它或评论/删除.

如果没有解决你的应用程序上的东西正在破坏会话.

【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月14日 0

暂无评论

推荐阅读
  TEZNKK3IfmPf   2024年05月17日   28   0   0 算法php
  TEZNKK3IfmPf   2024年03月29日   46   0   0 php
  TEZNKK3IfmPf   2024年04月19日   37   0   0 php
  TEZNKK3IfmPf   2024年04月19日   65   0   0 shellphp
  TEZNKK3IfmPf   2024年04月19日   42   0   0 php
  TEZNKK3IfmPf   2024年05月17日   49   0   0 冒泡排序php
  TEZNKK3IfmPf   2024年04月19日   37   0   0 xmlphp
  TEZNKK3IfmPf   2024年05月17日   40   0   0 数组php
  TEZNKK3IfmPf   2024年03月29日   48   0   0 数据库mysqlphp
  TEZNKK3IfmPf   2024年05月17日   49   0   0 mysqlphp
  TEZNKK3IfmPf   2024年04月19日   55   0   0 php
  TEZNKK3IfmPf   2024年05月17日   33   0   0 字符串php
TEZNKK3IfmPf