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="*