php - 使用 PHP 解析 xml 文件中的 CDATA 标记
问题描述
我必须从 xml 文件中提取一些信息。标签图片如下:
<pictures>
<picture>
<picture_url>
<![CDATA[
http://www....jpg
]]>
</picture_url>
</picture>
.
.
.
</pictures>
我不会尝试解析它来为每个 .
我尝试打印此内容,但结果如下:
object(SimpleXMLElement)#258 (1) {
["picture"]=>
array(5) {
[0]=>
object(SimpleXMLElement)#966 (1) {
["picture_url"]=>
object(SimpleXMLElement)#973 (0) {
}
}
[1]=>
object(SimpleXMLElement)#968 (1) {
["picture_url"]=>
object(SimpleXMLElement)#973 (0) {
}
}
[2]=>
object(SimpleXMLElement)#972 (1) {
["picture_url"]=>
object(SimpleXMLElement)#973 (0) {
}
}
[3]=>
object(SimpleXMLElement)#974 (1) {
["picture_url"]=>
object(SimpleXMLElement)#973 (0) {
}
}
[4]=>
object(SimpleXMLElement)#970 (1) {
["picture_url"]=>
object(SimpleXMLElement)#973 (0) {
}
}
}
}
我怎样才能追踪照片的网址?
非常感谢!