php simplexml_load_string 返回的对象print_r后,丢失信息?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?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);

 结果:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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://*.com/questions/21660547/simplexml-load-string-has-a-bug

php simplexml_load_string 返回的对象print_r后,丢失信息?

上一篇:javascript 实现继承的方法


下一篇:在桌面右下角弹出提醒框(JS)