header('Access-Control-Allow-Origin: *'); Not allowing CORS request

前端 未结 3 1289
醉酒成梦
醉酒成梦 2021-02-06 06:45

I have a PHP file which generates a JSON document.

I\'ve set the header as follows but am still getting an error.

header(\'Access-Control-Al         


        
3条回答
  •  北荒
    北荒 (楼主)
    2021-02-06 07:27

    It doesn't look there is anything wrong with the code that sets the header, but you may want to check if the header is actually being set. Use curl -i http://yourapp to check the response headers being sent to debug it. Alternatively, you can use the network tab in Google Chrome's web inspector, or the Network tool in Firefox's Web Developer tools.

提交回复
热议问题