讨论数量:
刚瞄了下源码,可以试试我这个办法。
改一下中间件:
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
use Illuminate\Session\TokenMismatchException;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
//
];
public function handle($request, Closure $next)
{
try {
return parent::handle($request, $next);
} catch (TokenMismatchException $e) {
// 自己的逻辑
}
}
}
Could not check compatibility between App\Http\Middleware\VerifyCsrfToken::handle($request, App\Http\Middleware\Closure $next) and Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::handle($request, Closure $next), because class App\Http\Middleware\Closure is not available
你这个方式会报这个错
推荐文章: