如何訪問此XML文件中最新條目的視圖?XML文件的PHP訪問值
https://www.youtube.com/feeds/videos.xml?channel_id=UCeNdjxcrWI5B1-j8mG4Nm7g
這是我的嘗試,但它不工作:
$xml = simplexml_load_file(sprintf('https://www.youtube.com/feeds/videos.xml?channel_id=%s', $channel_id));
foreach ($xml->entry as $entry) {
if (!empty($entry->children('yt', true)->videoId[0])){
$views = $entry->children('group')->children('community')->statistics['views'];
echo $views;}}
你可以發佈你的代碼的其餘部分? – FatBoyXPC
現在應該改變! – BlackWolve