<p class="sycode"> $xmlstring = <<<XML <br /> <?xml version="1.0" encoding="utf-8" ?> <br> <注意> <br> <name>乐杨俊</name> <br> <from>php将XML转成数组</from> <br> <working>BJ</working> <br> <desc>乐杨俊php相关浅谈!</desc> <br> </note> <br> XML; <br> <br> <br> $xml = simplexml_load_string($xmlstring); <br> $data['info'] = json_decode(json_encode($xml),TRUE); <br> echo "<pre>"; <br> print_r($data); <br> foreach($data as $values){ <br> foreach($values as $dv){ <br> echo $dv."n"; <br> } <br> } </p>