問題描述
我剛剛使用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]的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!