role代码
Route::group([], function () { Route::get('admin/xxxx', 'xxxx/xxxx/xxxx')->allowCrossDomain(); })->middleware('Check');
中间件代码:
header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Headers: Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With'); header('Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE, OPTIONS'); header('Access-Control-Max-Age: 1728000');
1.需要加allowCrossDomin去进行允许options请求,以及中间件
2.需要在中间件加跨域处理