P粉3114235942023-07-30 00:22:14
解決方案在這篇很好的文章中有解釋。您需要使用children()方法存取包含命名空間的XML元素。以下程式碼片段摘自該文章:
$feed = simplexml_load_file('http://www.sitepoint.com/recent.rdf'); foreach ($feed->item as $item) { $ns_dc = $item->children('http://purl.org/dc/elements/1.1/'); echo $ns_dc->date; }