ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
~~~ header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Methods: POST, GET, PUT, OPTIONS, DELETE'); //支持的http 动作 header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, x-access-sign, x-access-time'); if (request()->isOptions()) { exit(); } ~~~ 跨域中间件 public function handle($request, \Closure $next) { header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Headers: Authorization, Origin, X-Requested-With, Content-Type,token, Accept, x-access-sign, x-access-time"); header("Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE"); if (strtoupper($request->method()) == "OPTIONS") { return response(); } return $next($request); }