方式1:
$GLOBALS['HTTP_RAW_POST_DATA']
方式2:
//获取返回的xml
$testxml = file_get_contents("php://input");
//将xml转化为json格式
$jsonxml = json_encode(simplexml_load_string($testxml, 'SimpleXMLElement', LIBXML_NOCDATA));
//转成数组
$result = json_decode($jsonxml, true);
我这边试了上面2个方法取到都为空 自己写了个方法
//获取 REQUEST_URI
$REQUEST_URI = $_SERVER['REQUEST_URI'];
getParam($REQUEST_URI);
function getParam($request_uri){
//截取?
$data = explode("?",$request_uri);
if(count($data) <= 1){
return [];
}
$data = $data[1];
$data = explode("&",$data);
$res = [];
foreach ($data as $v){
$item = explode("=",$v);
$res[$item[0]] = urldecode($item[1]);
}
return $res;
}