PHP's header across domains

Recorded in the previous blog PHP solve cross-domain solutions: JSONP; https://www.cnblogs.com/pawn-i/p/11899120.html

In addition, after jsonp, or solve the problem of cross-domain response header by the header function settings:

Set up to allow access to domain name:

  1. Allow access to all of the domain name
    header("Access-Control-Allow-Origin:*");
  2. It allows you to specify domain names
    header( 'Access-Control-Allow-Origin:http://a.test.com' );  

Allowed access requests by:

  1.  One or more
    header('Access-Control-Allow-Methods:POST,GET,OPTIONS,DELETE'); 
  2. Complete
    header('Access-Control-Allow-Methods:*');  

And then you need to re-set other parameters ......

Guess you like

Origin www.cnblogs.com/pawn-i/p/12146661.html