Laravel 5.1
我偶尔会收到此错误,通常是在IE11上登录,但有时也会在AJAX调用上。我在登录表单中有相应的csrf字段,并且我还将它添加到AjaxSetup函数中。
我认为它是用ajax发生的,因为用户会在一段时间后回到页面并尝试在会话过期后使用该功能。
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}