Laravel 5.5 登录和注册页面说:由于不活动,页面已过期.[TokenMismatchException] [英] Laravel 5.5 login and register page says:The page has expired due to inactivity.[TokenMismatchException]

查看:25
本文介绍了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]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆