我正在尝试从雅虎的API中获取一些数据,但我遇到了一些麻烦。
这是雅虎JSON输出的片段
cbfunc({
"query": {
"count": 25,
"created": "2012-03-10T07:49:06Z",
"lang": "en-US",
"diagnostics": {
"publiclyCallable": "true",
"url": {
"execution-start-time": "2",
"execution-stop-time": "364",
"execution-time": "362",
"content": "http://us.music.yahooapis.com/track/v1/list/search/track/Madonna?start=1&count=25"
},
"user-time": "369",
"service-time": "362",
"build-version": "25587"
},
"results": {
"Track": [
{
"discNumber": "1",
"duration": "0",
"explicit": "0",
"flags": "0",
"id": "31884342",
"label": "Touch and Go Records",
"popularity": "3",
"rating": "-1",
"releaseYear": "2003",
"rights": "160",
"title": "Madonna",
"trackNumber": "10",
"url": "http://new.music.yahoo.com/cocorosie/tracks/madonna--31884342",
"Artist": {
"catzillaID": "1927768063",
"flags": "57859",
"hotzillaID": "1808720053",
"id": "23301762",
"name": "Cocorosie",
"rating": "-1",
"trackCount": "118",
"url": "http://new.music.yahoo.com/cocorosie/",
"website": "http://www.cocorosieland.com/"
},
"Album": {
"Release": {
"UPC": "036172095360",
"explicit": "0",
"flags": "2",
"id": "31881255",
"label": "Touch and Go Records",
"rating": "-1",
"releaseDate": "2003-09-20T07:00:00Z",
"releaseYear": "2003",
"rights": "160",
"title": "La Maison De Mon Rêve",
"typeID": "2",
"url": "http://new.music.yahoo.com/cocorosie/albums/maison-de-mon-reve--31881255",
"Image": [
{
"size": "40",
"url": "http://d.yimg.com/ec/image/v1/release/31881255?size=40"
},
{
"size": "65",
"url": "http://d.yimg.com/ec/image/v1/release/31881255?size=65"
},
{
"size": "75",
"url": "http://d.yimg.com/ec/image/v1/release/31881255?size=75"
},
{
"size": "80",
"url": "http://d.yimg.com/ec/image/v1/release/31881255?size=80"
},
{
"size": "110",
"url": "http://d.yimg.com/ec/image/v1/release/31881255?size=110"
},
{
"size": "135",
"url": "http://d.yimg.com/ec/image/v1/release/31881255?size=135"
},
{
"size": "200",
"url": "http://d.yimg.com/ec/image/v1/release/31881255?size=200"
},
{
"size": "300",
"url": "http://d.yimg.com/ec/image/v1/release/31881255?size=300"
},
{
"size": "654",
"url": "http://d.yimg.com/ec/image/v1/release/31881255?size=654"
},
{
"size": "800",
"url": "http://d.yimg.com/ec/image/v1/release/31881255?size=800"
}
]
}
},
我遇到的问题是我只能在“曲目”下进行数据处理。我想检索更多数据。 “专辑”和“艺术家”下的数据。
非常感谢任何帮助。
答案 0 :(得分:0)
您可以将其作为
进行访问$Track->Artist->name
$Track->Album->Release->label
在foreach循环中