Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/237.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过'访问XMLHttpRequest;http://localhost/api/car/create.php' 来自原点';http://localhost:4200' 已被CORS策略阻止_Php - Fatal编程技术网

通过'访问XMLHttpRequest;http://localhost/api/car/create.php' 来自原点';http://localhost:4200' 已被CORS策略阻止

通过'访问XMLHttpRequest;http://localhost/api/car/create.php' 来自原点';http://localhost:4200' 已被CORS策略阻止,php,Php,我试图将数据发送到服务器,在那里我遇到了这个cros错误。 我已经在api的标题上添加了以下标题: header("Access-Control-Allow-Origin: *"); header("Content-Type: application/json; charset=UTF-8"); header("Access-Control-Allow-Methods: POST"); header("Access-Contr

我试图将数据发送到服务器,在那里我遇到了这个cros错误。 我已经在api的标题上添加了以下标题:

header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");
header("Access-Control-Allow-Methods: POST");
header("Access-Control-Max-Age: 3600");
header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With");
但还是一样的错误