它只是通过轨道值。我需要的是获取用户名。这是我使用的,谢谢
{ “项目”:[ { “种类”:“轨道”, “身份证”:33369455, "uri":"https://api.soundcloud.com/tracks/33369455", “用户”:{ “身份证”:758840, "用户名":"JoeDreamer", "avatar_url":"https://i1.sndcdn.com/avatars-000006878204-maqsrd-large.jpg?923db0b"}, "download_count":0, “comment_count”:1 }, { “种类”:“轨道”, “身份证”:33369455, "uri":"https://api.soundcloud.com/tracks/33369455", “用户”:{ “身份证”:758840, "用户名":"JoeDreamer", "avatar_url":"https://i1.sndcdn.com/avatars-000006878204-maqsrd-large.jpg?923db0b"}, "download_count":0, “comment_count”:1 }] }
$user = json_decode(file_get_contents("http://mydata.com/data.json")); foreach($user->items as $mydata) { 回声 $mydata->id 。"\n"; foreach($mydata->user as $value) { 回声 $value->用户名 。"\n"; } }