Laravel … Automatically execute a script after few hours

喜夏-厌秋 提交于 2019-12-24 13:45:52

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!