📜  访问控制允许标头 - 任何代码示例

📅  最后修改于: 2022-03-11 14:56:23.748000             🧑  作者: Mango

代码示例2
//Access to XMLHttpRequest at 'http://localhost/[api path].php' from origin 'http://localhost:4200' has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response.

//The error is simply saying that "Content-Type" is missing from "Access-Control-Allow-Headers".

//Therefore we need to add "Content-Type" to "Access-Control-Allow-Headers".