修改route/route.php中的路由例如
Route::get('new/:id', 'News/read')
->ext('html')
->header('Access-Control-Allow-Origin','*')//不需要token的接口不用添加
->header('Access-Control-Allow-Credentials', 'true')//不需要token的接口不用添加
->allowCrossDomain();
添加上述红色字体
向应用入口文件public/index.php中添加
header('Access-Control-Allow-Headers: content-type,token');
原文链接:https://blog.csdn.net/viva_la_free/article/details/82964395