1 回答

TA貢獻1848條經驗 獲得超10個贊
嘗試以下對數組的 xml 響應
$xml = $response;
$xml = preg_replace("/(<\/?)(\w+):([^>]*>)/", "$1$2$3", $xml);
$xml = simplexml_load_string($xml);
$json = json_encode($xml);
$responseArray = json_decode($json,true);
echo "<pre>";print_r($responseArray);
輸出
Array
(
[soapBody] => Array
(
[ns2setTransactionResponse] => Array
(
[return] => Array
(
[merchantReference] => mercRef_1395758213
[payUReference] => 17613281409117
[successful] => true
)
)
)
)
- 1 回答
- 0 關注
- 160 瀏覽
添加回答
舉報