我正在尝试使用简单的 xml 阅读器从该文件中读取 xml 节点的属性
<songs>
<song title="On Mercury" artist="Red Hot Chili Peppers" path="/red-hot-chili-peppers/on-mercury.mp3" />
<song title="Universally Speaking" artist="Red Hot Chili Peppers" path="/red-hot-chili-peppers/universally-speaking.mp3" />
</songs>
我用那个代码来阅读它,但它给了我 xml 解析错误
<?php
$xml = simplexml_load_file("playlist.xml")
or die("Error: Cannot create object");
foreach($xml->children() as $data){
echo $data->song['title'];
echo "<br />";
}
?>
请帮我