Laravel 5.5 login and register page says:The page has expired due to inactivity.[TokenMismatchException](Laravel 5.5 登录和注册页面说:由于不活动,页面已过期.[TokenMismatchException])
问题描述
我刚刚使用laravel安装程序创建了一个laravel 5.5版本的新项目.并运行命令php artisan make:auth".为用户身份验证生成视图和控制器.还有运行php artisan migrate"创建数据库中需要的表.访问登录页面和注册页面时,填写表单并提交.显示页面因不活动而过期.请刷新并再试一次.".但刷新页面没有任何帮助.在源码中看到,是哪里导致了异常:
I just created a new project of laravel version 5.5 with the laravel installer.And run the command "php artisan make:auth".The views and controller are generated for the user authentication.And also run "php artisan migrate" to create tables needed in the database.When visiting the login page and register page,filling the form and submit.It shows "The page has expired due to inactivity. Please refresh and try again.".But refreshing the page does nothing help. Seen in the source code,where causes the exception:
if ($e instanceof ModelNotFoundException) {
$e = new NotFoundHttpException($e->getMessage(), $e);
} elseif ($e instanceof AuthorizationException) {
$e = new AccessDeniedHttpException($e->getMessage());
} elseif ($e instanceof TokenMismatchException) {
$e = new HttpException(419, $e->getMessage());
}
似乎是TokenMismatchException"导致了这个问题.这是什么时候发生的?为什么?我只是创建了这个新项目,没有做任何其他更改.希望你得到积分.我使用 php 7.1.9(laravel 5.5 需要 php > 7.0.0).并在开发环境中使用:php artisan serve
It seems "TokenMismatchException" causing this problem. When did this happen?And why?I just create this new project and did not do any other changes. Hope you got the points. I use php 7.1.9(laravel 5.5 requires php > 7.0.0).And serve the project in develop environment with:php artisan serve
推荐答案
我在 localhost:8000
(php artisan serve
) 上遇到了同样的问题.也许这是巧合,但请尝试使用 "clean browser" ,而不是您在以前的开发中使用的.对我来说它奏效了.
I had the same problem on localhost:8000
(php artisan serve
). Maybe it's coincidence, but try on "clean browser" , other than you used with previous development.
For me it worked.
问题似乎出在同一 url 上使用以前的 Laravel 版本开发的 cookie.
It seems that the problem is with cookies from development with previous Laravel versions, on the same url.
这篇关于Laravel 5.5 登录和注册页面说:由于不活动,页面已过期.[TokenMismatchException]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Laravel 5.5 登录和注册页面说:由于不活动,页面已
基础教程推荐
- 如何在 XAMPP 上启用 mysqli? 2021-01-01
- 如何在 Symfony 和 Doctrine 中实现多对多和一对多? 2022-01-01
- phpmyadmin 错误“#1062 - 密钥 1 的重复条目‘1’" 2022-01-01
- HTTP 与 FTP 上传 2021-01-01
- 使用 PDO 转义列名 2021-01-01
- PHP 守护进程/worker 环境 2022-01-01
- 在 yii2 中迁移时出现异常“找不到驱动程序" 2022-01-01
- Doctrine 2 - 在多对多关系中记录更改 2022-01-01
- 在 CakePHP 2.0 中使用 Html Helper 时未定义的变量 2021-01-01
- 找不到类“AppHttpControllersDB",我也无法使用新模型 2022-01-01