Laravel ...几个小时后自动执行脚本 [英] Laravel ... Automatically execute a script after few hours

查看:389
本文介绍了Laravel ...几个小时后自动执行脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

laravel是否有可能在几个小时后(例如10小时)自动注销用户,即使浏览器已关闭并且用户没有手动注销.

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.

推荐答案

在app/config/session.php中查找以下代码:

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,

将生存时间"设置为您希望会话保持活动状态的时间(以分钟为单位).例如如果要10个小时,请将其设置为600.

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.

这篇关于Laravel ...几个小时后自动执行脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆