【发布时间】:2021-08-23 08:48:21
【问题描述】:
我正在使用 laravel 8 和惯性 js,我在 .env 文件中将 session_timeout 设置为 10 分钟。
问题是在我提交表单 10 分钟不活动后,我得到一个模型说 419 |页已过期。如果我尝试访问其他页面,它就像没有超时会话一样工作
这是我的 .env 的代码
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=database
SESSION_DRIVER=file
SESSION_LIFETIME=1
session.php 中的代码
'lifetime' => env('SESSION_LIFETIME', 120),
'expire_on_close' => true,
如何在 10 分钟不活动后将用户重定向到登录页面?
我的 handler.php 文件
<?php
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $dontFlash = [
'password',
'password_confirmation',
];
/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
{
//
}
}
【问题讨论】:
标签: php laravel vue.js session inertiajs