通过'访问XMLHttpRequest;http://localhost/api/car/create.php' 来自原点';http://localhost:4200' 已被CORS策略阻止
我试图将数据发送到服务器,在那里我遇到了这个cros错误。 我已经在api的标题上添加了以下标题:通过'访问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
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");
但还是一样的错误