1
我有這個數組,我用json_decode來創建。這是我的代碼:從PHP陣列獲取數據
$obj = json_decode($json);
$results = $obj->{"results"}; // This selects the results section
echo $results[artistName];
$結果是數組
數組是這樣的:
array(1) {
[0]=> object(stdClass)#5 (8) {
["wrapperType"]=> string(6) "artist"
["artistType"]=> string(6) "Artist"
["artistName"]=> string(5) "Human"
["artistLinkUrl"]=> string(56) "https://itunes.apple.com/us/artist/human/id35761368?uo=4"
["artistId"]=> int(35761368)
["amgArtistId"]=> int(1173165)
["primaryGenreName"]=> string(3) "Pop"
["primaryGenreId"]=> int(14)
}
}
但它不會迴應任何事情。請幫忙。
謝謝!這工作完美! –