php – Laravel 7 Session Lifetime

举报
Lansonli 发表于 2021/09/27 22:29:45 2021/09/27
【摘要】 根据Laravel config / session.php /* |-------------------------------------------------------------------------- | Session Lifetime |--------------------------------------...

根据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配置.

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

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

文章来源: lansonli.blog.csdn.net,作者:Lansonli,版权归原作者所有,如需转载,请联系作者。

原文链接:lansonli.blog.csdn.net/article/details/109279697

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。