已经在php接口文件中添加:
header("Access-Control-Allow-Origin:*");
header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept');
然而前端调用接口请求数据时仍然报错:
Failed to load http://aaa.com/version?test=1: Redirect from 'http://aaa.com/version?test=1' to 'http://bbb.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://ccc.com' is therefore not allowed access.
慕虎7371278
胡子哥哥
米琪卡哇伊