php – Laravel 7 Session Lifetime
根據(jù)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'))
我已將會話的生命周期設(shè)置為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優(yōu)先于Laravel配置.
你可以增加它或評論/刪除.
如果沒有解決你的應(yīng)用程序上的東西正在破壞會話.
總結(jié)
以上是生活随笔為你收集整理的php – Laravel 7 Session Lifetime的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Laravel中Redis的配置和使用
- 下一篇: Laravel7中Redis队列的使用