Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/268.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在Laravel 5中会话到期时自动注销用户_Php_Laravel_Session - Fatal编程技术网

Php 在Laravel 5中会话到期时自动注销用户

Php 在Laravel 5中会话到期时自动注销用户,php,laravel,session,Php,Laravel,Session,在Laravel中,有没有办法在会话到期后立即注销用户?我知道,也许最简单的替代方法是在会话过期后发送请求时让注销发生,事实上,我在我的网站上就是这样处理的,但是由于前端的一些问题,我再也不能这样做了。有什么想法吗?Laravel会处理这个问题,并提供一个配置文件“session.php”,供您根据需要配置选项 上述文件的摘录 /* |--------------------------------------------------------------------------

在Laravel中,有没有办法在会话到期后立即注销用户?我知道,也许最简单的替代方法是在会话过期后发送请求时让注销发生,事实上,我在我的网站上就是这样处理的,但是由于前端的一些问题,我再也不能这样做了。有什么想法吗?

Laravel会处理这个问题,并提供一个配置文件“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' => 43200,

    'expire_on_close' => false,

我能想到的唯一方法是安排一个来自FE的简单检查呼叫,并检查状态。如果有人关闭浏览器,您从哪里获得该请求…请添加一些您以前尝试过的代码。您不能将生存时间设置为x秒,让laravel处理此问题,您需要处理403状态代码吗(假设你这样做了)在前端?