本帖最后由 xiaohua1054 于 2011-12-25 20:44:15 编辑

解决方案 »

  1.   

    <?php
     $xml = '
                        <root>
                            <root1>
                                <root1>a</root1>
                                <root2>b</root2>
                                <root6>
                                    <root7>e</root7>
                                </root6>
                            </root1>
                            <root2>
                                <root3>c</root3>
                                <root4>d</root4>
                                <root6>
                                    <root8>e</root8>
                                </root6>
                            </root2>
                            <title>f</title>
                        </root>
                ';$obj=new SimpleXMLElement($xml);
    $arr=json_decode(json_encode($obj),true);
    print_r($arr);
    ?>
      

  2.   

    来晚了,但是还是分享一下我处理 PHP 数组与 XML 互转的类库
    http://www.bacysoft.cn/thread-91-1-1.html