php – Laravel 7 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配置.

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

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

©️2020 CSDN 皮肤主题: 代码科技 设计师:Amelia_0503 返回首页
实付 9.90元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值