php xml转array的方法

<pre>

<?php


$responseXml='<xml><appid>12</appid></xml>';

//simplexml_load_string 这个是xml转成对象

$responseObj = simplexml_load_string($responseXml, 'SimpleXMLElement', LIBXML_NOCDATA);

//对象转成数组

$responseObj = json_decode( json_encode( $responseObj),true);

print_r($responseObj);

?>

</pre>