【发布时间】:2010-11-11 03:48:03
【问题描述】:
我想知道如何解析 XML 中名称中包含 : 的值。我一直在使用:
$response = file_get_contents($url);
$data = simplexml_load_string($response);
然后做一个:
foreach($data->item as $key => $current){
但是,我收到的最新提要之一的提要名称中有冒号,如下例所示:
<item>
<title>foo</title>
<description>foo</description>
<ccc:fid>10</ccc:fid>
<ccc:bid>6</ccc:bid>
</item>
当我尝试创建 $current->ccc:bid 时,php 并不高兴(理所当然)。有没有办法解决这个问题?
【问题讨论】:
标签: php xml namespaces