>假设用户打开了两个页面。在其中一个中,触摸注销按钮。然后在另一页上,再次触摸注销按钮。
其中有错误:
(1/1) TokenMismatchException
In VerifyCsrfToken.php (line 68)
At VerifyCsrfToken-> handle (object (Request), object (Closure)) in Pipeline.php (line 148) ......
.你有什么解决方案吗?
in App\Exceptions\Handler.php使用新的有效CSRF令牌将用户返回到表单,因此页面将刷新,注销按钮将不存在。
public function render($request, Exception $exception)
{
if($exception instanceof TokenMismatchException)
{
return redirect()
->back()
->with('your msg');
}
return parent::render($request, $exception);
}
这看起来像,页面已刷新。
不要将POST替换为Get。它不会安全和标准。