【发布时间】:2011-05-17 07:06:55
【问题描述】:
我正在尝试获取 RSS 提要中每个条目的 entry->id 和 entry->cap:parameter->value.... 下面是我正在使用的代码。它正确显示了 id,但是它没有显示 value 字段....请帮助。
$url = 'http://alerts.weather.gov/cap/us.php?x=1';
$cap = simplexml_load_file($url);
foreach($cap->entry as $entry){
echo 'ID: ', $entry->id, "\n";
echo 'VTEC: ', $entry->children('cap', true)->parameter->value, "\n";
echo "<hr>";
}
提前感谢您的帮助。
【问题讨论】:
-
你能发布一个 XML 文档的示例吗?