ajax的跨域问题

一  本地跨域

提示错误:Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.

我直接双击打开index.html使用的时,使用的是file协议,chrome不支持。

解决方案:

    1.在服务器中打开,使用htttp协议。

    2.给chrome添加启动参数。

       参考: https://blog.csdn.net/carechere/article/details/51771277

                   https://blog.csdn.net/wei_ge163/article/details/7638685

二  PHP跨域的解决方案 

      参考:http://www.runoob.com/w3cnote/php-ajax-cross-border.html

 

原文地址:https://www.cnblogs.com/githubMYL/p/8627240.html