我有一个 JSON 结构,例如http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist=Cher&api_key=XXXX&format=json并且我想挑选出各种信息,例如类似的艺术家(姓名和图片)、标签、超大图片、内容等
我让类似的艺术家通过使用
<?php
$url = 'http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist=Queens%20Of%20the%20STone%20Age&api_key=XXX&format=json';
$content = file_get_contents($url);
$json = json_decode($content, true);
foreach($json['artist']['similar']['artist'] as $item) {
print $item['name'];
print '<br>';
}
?>
但是,如何从以下内容中提取“大”图像:
"artist": [{
"name": "Them Crooked Vultures",
"url": "http:\/\/www.last.fm\/music\/Them+Crooked+Vultures",
"image": [{
"#text": "http:\/\/userserve-ak.last.fm\/serve\/34\/38985285.jpg",
"size": "small"
}, {
"#text": "http:\/\/userserve-ak.last.fm\/serve\/64\/38985285.jpg",
"size": "medium"
}, {
"#text": "http:\/\/userserve-ak.last.fm\/serve\/126\/38985285.jpg",
"size": "large"
}]
谢谢,
JJ
全部排序!成品: http: //www.strictlyrandl.com/artist/queens-of-the-stone-age/