创建时间:2018-04-20
设置PHP 允许Ajax跨域访问 (Access-Control-Allow-Origin)
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Headers: x-token, x-uid, Origin, X-Requested-With, Content-Type, Accept");
header('Access-Control-Allow-Methods: GET, POST, PUT, OPATION');设置返回json格式数据
header('content-type:application/json;charset=utf8');$info = array( 'code'=>200, 'tips'=>'tips', );echo json_encode($info);