apaceh 配置:
<VirtualHost *:80> ServerAdmin xxx@qq.com DocumentRoot "C:/htdocs/demo" ServerName dev.dd.cn ##ErrorLog "logs/dummy-host.localhost-error.log" ##CustomLog "logs/dummy-host.localhost-access.log" combined <Directory "C:/htdocs/demo"> #Require all denied Header set Access-Control-Allow-Origin * </Directory> </VirtualHost>
PHP文件设置:
<"Access-Control-Allow-Origin:*"); //处理请求输出数据 "http://feng.com" rel="external nofollow" >http://feng.com这个域才能跨域访问服务器的API。httpd.conf:
<VirtualHost *:80> ServerAdmin xxx@qq.com DocumentRoot "C:/htdocs/demo" ServerName dev.dd.cn ##ErrorLog "logs/dummy-host.localhost-error.log" ##CustomLog "logs/dummy-host.localhost-access.log" combined <Directory "C:/htdocs/demo"> #Require all denied Header set Access-Control-Allow-Origin http://feng.com </Directory> </VirtualHost>PHP文件中:
header("Access-Control-Allow-Origin:http://feng.com");以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com
暂无“php apache开启跨域模式过程详解”评论...