小编Eau*_*tey的帖子

Laravel 5.6 会话超时自动注销

我对 Laravel 框架很陌生。我正在开发一个应用程序,当用户处于非活动状态 5 分钟时,它会自动注销。我使用了这里的代码:https : //github.com/unicodeveloper/laravel-sessiontimeout/blob/master/src/Middleware/SessionTimeout.php但它似乎对我不起作用。

这是中间件代码:

<?php

namespace App\Http\Middleware;

use Closure;
use Auth;
use Illuminate\Session\Store;

class SessionTimeOutMiddleware
{
  /**
  * Instance of Session Store
  * @var session
  */
  protected $session;
  /**
   * Time for user to remain active, set to 300 secs( 5 minutes )
   * @var timeout
  */
  protected $timeout = 300;
  public function __construct(Store $session){
   $this->session        = $session;
   $this->redirectUrl    = 'auth/login';
   $this->sessionLabel   = 'warning';
 }
  /**
   * Handle an incoming request.
   *
   * @param …
Run Code Online (Sandbox Code Playgroud)

session timeout laravel laravel-5.6

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

laravel ×1

laravel-5.6 ×1

session ×1

timeout ×1