Cross-Origin Request Headers(CORS) with PHP headers

后端 未结 11 1360
情书的邮戳
情书的邮戳 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:40

    CORS can become a headache, if we do not correctly understand its functioning. I use them in PHP and they work without problems. reference here

    header("Access-Control-Allow-Origin: *");
    header("Access-Control-Allow-Credentials: true");
    header("Access-Control-Max-Age: 1000");
    header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, Origin, Cache-Control, Pragma, Authorization, Accept, Accept-Encoding");
    header("Access-Control-Allow-Methods: PUT, POST, GET, OPTIONS, DELETE");
    

提交回复
热议问题