header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods:*");
header("Access-Control-Allow-Headers:x-requested-with,content-type");
补充:
header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Credentials: true'); // 设置是否允许发送 cookies header('Access-Control-Expose-Headers: *'); //服务器 headers 白名单,可以让客户端进行访问 header('Access-Control-Allow-Headers: *');