P粉0870748972023-07-30 00:29:27
In the latest version, you can now use curly braces to reference nodes with colons.
$item->{'itunes:duration'}
P粉3114235942023-07-30 00:22:14
The solution is explained in this great article. You need to use the children() method to access the XML element containing the namespace. The following code snippet is taken from the article:
$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; }