PHP处理前端API接口跨域名
在API返回前加入下面三行。
|
1
2
3
|
header("Access-Control-Allow-Origin:*"); //允许访问的来源域名header('Access-Control-Allow-Methods:POST'); //响应类型: post,get等 允许的请求方式header('Access-Control-Allow-Headers:x-requested-with, content-type'); //响应头设置 |

浙公网安备 33010602011771号