Thinkphp开发接口跨域问题 - 技术文摘 - 哈尔滨APP开发公司-哈尔滨手机软件开发-哈尔滨app制作-哈尔滨手机软件开发-app开发 

Thinkphp米乐m6app接口跨域问题

发布时间:2020-08-07 09:46:39 作者:哈尔滨app米乐m6app公司哈尔滨app米乐m6appapp米乐m6app公司

访问接口出错:Failed to load http: localhost:8080 XXXX: No & 39;Access-Control-Allow-Origin& 39; header is present on t

访问接口出错:
Failed to load http://localhost:8080/XXXX: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8081' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

说明接口输入格式跨域没有设置,在 thinkphp中接口输出或index.php中添加代码 :

header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");
header('Access-Control-Allow-Methods: GET, POST, PUT');
评论

相关阅读



联系我们

哈尔滨云创科技有限公司

地址:黑龙江省哈尔滨市南岗高新米乐m6app区嵩山路5号
电话:0451-51035763 51030378
在线QQ:191814825