问题
Is it possible with laravel to logout a user automatically after few hours, say 10, even of the browser is closed and user doesn't log-out manually.
回答1:
In app/config/session.php look for this code:
/*
|--------------------------------------------------------------------------
| 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' => false,
Set 'lifetime' to the amount of time you want the session to be active for, in minutes. e.g. if you want 10 hours set it to 600.
来源:https://stackoverflow.com/questions/28603972/laravel-automatically-execute-a-script-after-few-hours