您的位置:首页 > 产品设计 > UI/UE

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin is therefore no

2016-10-12 13:54 507 查看

No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin is therefore no错误解决

问题:在php中使用ajax跨域访问报错No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin is therefore not allowed access.

解决:

1、如果请求的url是PHP页面,则需要在PHP页面中添加代码:header("Access-Control-Allow-Origin: *");

2、如果请求的url是静态的html页面,则需要在页面中添加meta标签代码:<meta http-equiv="Access-Control-Allow-Origin" content="*
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐