本文主要是介绍No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin is therefore no,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
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="*
这篇关于No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin is therefore no的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!