php 跨域请求

执行要在跨域请求的服务器端对应的代码上增加下面的代码

<?php

namespace Admin\Controller;

// 指定允许跨域访问  
header('Access-Control-Allow-Origin:*');    
header('Access-Control-Allow-Origin:http://你的请求域名');  
header('Access-Control-Allow-Credentials:true');
header('Access-Control-Allow-Methods:GET, POST, PUT, DELETE, OPTIONS');
header('Access-Control-Allow-Headers:X-Requested-With,content-type');

//下面是你的代码

猜你喜欢

转载自www.cnblogs.com/scott-j/p/9030890.html
今日推荐