1
Laravel 5.1Laravel現場異常「照亮會議 TokenMismatchException」
我偶爾會收到此錯誤,最常登錄在IE11但有時在AJAX調用了。我在我的登錄窗體中有相應的csrf字段,並且我也將它添加到了AjaxSetup函數中。
我認爲它發生在ajax上,因爲用戶在一段時間後回到頁面,並嘗試在會話過期後使用函數。
雖然IE11問題已經被註銷,但IE11問題讓我感到困惑。
如何在會話過期後使用ajax函數時自動重定向到登錄?
如何防止IE11在嘗試登錄時產生此錯誤?
。
Error of type ERROR [03/02/2016 11:06 am]: exception 'Illuminate\Session\TokenMismatchException' on page /var/www/vendor/bootstrap/cache/compiled.php
Stack trace:
#0 [internal function]: Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#1 /var/www/vendor/bootstrap/cache/compiled.php(9585): call_user_func_array(Array, Array)
#2 /var/www/vendor/bootstrap/cache/compiled.php(12961): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#3 [internal function]: Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#4 /var/www/vendor/bootstrap/cache/compiled.php(9585): call_user_func_array(Array, Array)
#5 /var/www/vendor/bootstrap/cache/compiled.php(11555): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#6 [internal function]: Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#7 /var/www/vendor/bootstrap/cache/compiled.php(9585): call_user_func_array(Array, Array)
#8 /var/www/vendor/bootstrap/cache/compiled.php(12698): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#9 [internal function]: Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#10 /var/www/vendor/bootstrap/cache/compiled.php(9585): call_user_func_array(Array, Array)
#11 /var/www/vendor/bootstrap/cache/compiled.php(12635): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#12 [internal function]: Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#13 /var/www/vendor/bootstrap/cache/compiled.php(9585): call_user_func_array(Array, Array)
#14 /var/www/vendor/bootstrap/cache/compiled.php(2982): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#15 [internal function]: Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#16 /var/www/vendor/bootstrap/cache/compiled.php(9585): call_user_func_array(Array, Array)
#17 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#18 /var/www/vendor/bootstrap/cache/compiled.php(9575): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#19 /var/www/vendor/bootstrap/cache/compiled.php(2254): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#20 /var/www/vendor/bootstrap/cache/compiled.php(2237): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#21 /var/www/vendor/public/index.php(54): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#22 {main}
我有這個在我的腦海''我會嘗試改變名稱 – Ethan22
這不應該已經有所作爲,因爲'$ .ajaxSetup'函數也使用了名稱'_token'。 – Ethan22
只要名稱匹配就沒關係。你有沒有檢查表格以確保他們有令牌字段? –