版权声明:本文为博主原创文章,未经博主允许不得转载。 https://cloud.tencent.com/developer/article/1333837
TokenMismatchException in VerifyCsrfToken.php line 67:
in VerifyCsrfToken.php line 67
at VerifyCsrfToken->handle(object(Request), object(Closure))
...
return $this->addCookieToResponse($request,$next($request));
}
throw new TokenMismatchException;
_csrf token
<input type="hidden" name="_token" value="{{ csrf_token() }}" />
csrf_field
(与上述解决方法功能一致){!! csrf_field() !!}
\App\Http\Middleware\VerifyCsrfToken::class
public function handle($request, \Closure $next)
{
// 使用CSRF
//return parent::handle($request, $next);
// 禁用CSRF
return $next($request);
}
app\Http\Middleware\VerifyCsrfToken.php
文件,找到protected $except = [
];
例如我要 http://xx.com/api/ 下面的都跳过验证,可改成如下所示:
protected $except = [
'api/*'
];
举例: