本文介绍了从这行获得< topalbums artist ="Adele">的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我试图从last.fm获取信息,我正在获取专辑名称等,但我想从第二行获取.如何获取?

Hello guys im trying to get info from last.fm, i'm getting albums names and etc, but i want to get from line 2. how to get it?

<topalbums artist="Adele" page="1" perPage="1" totalPages="55092" total="55092">

^从这里的名称,页面,每页和总页数

^from here name, page, perpage and totalpages

<lfm status="ok">
<topalbums artist="Adele" page="1" perPage="1" totalPages="55092" total="55092">
<album>

<name>21</name>
<playcount>52308837</playcount>
<mbid>c45e0e0e-48c9-4441-aac3-2f2b34202d3c</mbid>
<url>https://www.last.fm/music/Adele/21</url>
<artist>

<name>Adele</name>
<mbid>cc2c9c3c-b7bc-4b8b-84d8-4fbd8779e493</mbid>
<url>https://www.last.fm/music/Adele</url>
</artist>
<image size="small">
https://lastfm-img2.akamaized.net/i/u/34s/c894af1e6a735b9bbb2a0312c7719f40.png
</image>
<image size="medium">
https://lastfm-img2.akamaized.net/i/u/64s/c894af1e6a735b9bbb2a0312c7719f40.png
</image>
<image size="large">
https://lastfm-img2.akamaized.net/i/u/174s/c894af1e6a735b9bbb2a0312c7719f40.png
</image>
<image size="extralarge">
https://lastfm-img2.akamaized.net/i/u/300x300/c894af1e6a735b9bbb2a0312c7719f40.png
</image>
</album>
</topalbums>
</lfm>

推荐答案

我很有趣地找到了最佳解决方案

Guys funnily i found best solution

<?php 
$attrs = $xml7->topalbums->attributes();
echo $attrs["total"];
?>

这篇关于从这行获得&lt; topalbums artist ="Adele"&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 22:37