DDR爱好者之家 Design By 杰米

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");

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。

DDR爱好者之家 Design By 杰米
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
DDR爱好者之家 Design By 杰米