1.針對跨域問題可以使用jsonp的方式解決
2.可以使用header頭來定義
header('Access-Control-Allow-origin:*'); header('Access-Control-Allow-Credentials:true'); header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS'); header('Access-Control-Allow-Headers:Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With'); header('Content-Type: text/html; charset=utf-8');
加上以后就可以了
但是這個缺陷是IE10以下的不支持!一般手機應用都可以用!