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:
- Allow access to all of the domain name
header("Access-Control-Allow-Origin:*");
- It allows you to specify domain names
header( 'Access-Control-Allow-Origin:http://a.test.com' );
Allowed access requests by:
- One or more
header('Access-Control-Allow-Methods:POST,GET,OPTIONS,DELETE');
- Complete
header('Access-Control-Allow-Methods:*');
And then you need to re-set other parameters ......