嘿,我正在尝试从 XML 文件中获取查看者。问题出在路径上,因为其他路径对我有用。我想问题是因为它是元素?<media:statistics views="131"/>
$url = "https://www.youtube.com/feeds/videos.xml?channel_id=UCH7Hj6l_xDmbyvjQOA5Du0g";
$xml = simplexml_load_file($url);
$views = $xml->entry[0]->children('media', true)->group[0]->children('media', true)->community[0]->children('media', true)->attributes('statistics');
echo $views;
达令说