标签:
通过在服务器端设置请求头的源可以实现跨域
public function test_ajax()
{
header("Access-Control-Allow-Origin: http://127.0.0.1:63851");
$arr = getallheaders();
foreach($arr as $key=>$val){
$data[$key] = $val;
}
echo json_encode($data);
exit;
}
ajax跨域之设置Access-Control-Allow-Origin
标签:
原文地址:http://www.cnblogs.com/toward-the-sun/p/5950146.html