<?php
// 全局中间件定义文件
return [
// 跨域支持
\think\middleware\AllowCrossDomain::class
];跨域无效,在入口文件或者api接口方法写:header("Access-Control-Allow-Origin: *");
header('Access-Control-Allow-Methods:GET, POST, PATCH, PUT, DELETE');
header('Access-Control-Allow-Headers:Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With');都无效,这是怎么回事? 最佳答案