最近在做微信支付接口,一般api反回的数据是json,但微信支付返回的是xml数据,为了能更好的的读取他,需要把它转换成json或数组,这里我们把他转为数组,
$msg = array();$postStr = file_get_contents('php://input');$msg = (array)simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
print_r($msg);
最近在做微信支付接口,一般api反回的数据是json,但微信支付返回的是xml数据,为了能更好的的读取他,需要把它转换成json或数组,这里我们把他转为数组,
$msg = array();$postStr = file_get_contents('php://input');$msg = (array)simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
print_r($msg);