Laravel 自动退出多个用户?

问题描述

我目前正在开发一个有多个用户的网站。 我测试了以隐身模式登录其他用户,几秒钟后,其中一些用户自动注销。 当仅使用 1 个用户时,网站不会注销并且工作正常。 我正在使用

我已经在 SESSION_DRIVER 文件中将 .env 更改为数据库,但仍然发生注销。你知道这方面的任何解释吗?谢谢。

public function grant_auth($name,$section)
    { 
        $data_auth =
        [
            'name' => $name,];

        if(Auth::attempt($data_auth))
        {
            Session::put('section',$section);
            Session::save();
            return Redirect::route('dashboard');
        }
        else
            return Redirect::to('login');
    }

我正在使用此代码授予身份验证。我没有使用 PHP artisan make:auth

解决方法

更改您的 config/session.php

'lifetime' => 4320,'expire_on_close' => false,

之后清除配置缓存

php artisan config:cache

更多信息:Laravel session expire time for each session