在php代码中
header('Access-Control-Allow-Origin:*');//允许所有来源访问 实现跨域
header('Access-Control-Allow-Method:POST,GET');//设置允许访问的方式