前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >php – Laravel 7 Session Lifetime

php – Laravel 7 Session Lifetime

作者头像
Lansonli
发布2021-10-09 16:27:43
1K0
发布2021-10-09 16:27:43
举报
文章被收录于专栏:Lansonli技术博客Lansonli技术博客

根据Laravel config / session.php

代码语言:javascript
复制
/*
|--------------------------------------------------------------------------
| 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配置.

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

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

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2020-10-25 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档