Cross-Origin Request Headers(CORS) with PHP headers

后端 未结 11 1373
情书的邮戳
情书的邮戳 2020-11-21 11:13

I have a simple PHP script that I am attempting a cross-domain CORS request:



        
11条回答
  •  青春惊慌失措
    2020-11-21 11:38

    I got the same error, and fixed it with the following PHP in my back-end script:

    header('Access-Control-Allow-Origin: *');
    
    header('Access-Control-Allow-Methods: GET, POST');
    
    header("Access-Control-Allow-Headers: X-Requested-With");
    

提交回复
热议问题