zoukankan      html  css  js  c++  java
  • php simplexml_load_string 返回的对象print_r后,丢失信息?

    <?php
    $content = '<dblp>
    <inproceedings key="conf/aaim/He07" mdate="2007-06-28">
    <author>Dan He</author>
    <title>
    <i>BMA</i>
    <sup>*</sup>
    : An Efficient Algorithm for the One-to-Some Shortest Path Problem on Road Maps.
    </title>
    <pages>346-357</pages>
    <year>2007</year>
    <crossref>conf/aaim/2007</crossref>
    <booktitle>AAIM</booktitle>
    <ee>http://dx.doi.org/10.1007/978-3-540-72870-2_33</ee>
    <url>db/conf/aaim/aaim2007.html#He07</url>
    </inproceedings>
    </dblp>';
    $xml = simplexml_load_string($content);
    print_r($xml);
    

     结果:

    SimpleXMLElement Object
    (
        [inproceedings] => SimpleXMLElement Object
            (
                [@attributes] => Array
                    (
                        [key] => conf/aaim/He07
                        [mdate] => 2007-06-28
                    )
    
                [author] => Dan He
                [title] => SimpleXMLElement Object
                    (
                        [i] => BMA
                        [sup] => *
                    )
    
                [pages] => 346-357
                [year] => 2007
                [crossref] => conf/aaim/2007
                [booktitle] => AAIM
                [ee] => http://dx.doi.org/10.1007/978-3-540-72870-2_33
                [url] => db/conf/aaim/aaim2007.html#He07
            )
    
    )
    

      在title中丢失了信息,因为返回的是一个迭代对象,具体查看http://stackoverflow.com/questions/21660547/simplexml-load-string-has-a-bug

    !!!我的新站地址点击这里,欢迎光顾!!!
  • 相关阅读:
    求第N个素数
    HDU1568
    HDU1003 DP
    POJ 1016 模拟字符串
    POJ 3321 树状数组(+dfs+重新建树)
    UVA12532 线段树(单点更新,区间求乘积的正负)
    POJ2488 dfs
    POJ 1195 二维树状数组
    HDU 4006 优先队列
    优先队列
  • 原文地址:https://www.cnblogs.com/martinjinyu/p/3553683.html
Copyright © 2011-2022 走看看