作者:陈翔瑋文爱奕德 | 来源:互联网 | 2018-03-20 13:01
PHP解析微信支付结果
1
$msg = array();
$postStr = file_get_contents('php://input');
$msg = (array)simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
$msg = array();
$postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
$msg = (array)simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
public function xmlToArray($xml)
{
//将XML转为array
$array_data = json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
return $array_data;
}