企业🤖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); }