我开发了一个laravel 5应用程序,除了IE和Edge之外,在所有其他浏览器上运行良好。我在所有表单提交上得到TokenMismatchException。我阅读了这篇博文https://robinz.in/csrf-token-session-error-with-laravel-on-ie-edge/
并实施以下内容作为尝试解决问题,但仍然无效:
创建了一个中间件
namespace App\Http\Middleware;
use Closure;
class IeFix
{
/**
* Handle an incoming request. Fix session error with Laravel on IE/Edge
*
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$response = $next($request);
$response->header('P3P', 'CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
return $response;
}
}
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\App\Http\Middleware\IeFix::class,
];
但我仍然在IE和Edge上得到同样的错误?我该怎么做才能解决这个问题?