嘿我试图看到什么最高的投票是这个数组内,然后从得到FILE_PATH。PHP循环,找到最高值
images =>
backdrops =>
0 =>
file_path => /gM3KKiN80qbJgKHjPnmAfwxSicG.jpg
width => 1920
height => 1080
iso_639_1 =>
aspect_ratio => 1.78
vote_average => 5.4529616724739
vote_count => 19
1 =>
file_path => /7u3pxc0K1wx32IleAkLv78MKgrw.jpg
width => 1920
height => 1080
iso_639_1 =>
aspect_ratio => 1.78
vote_average => 5.4509803921569
vote_count => 22
2 =>
etc etc....
我想这样做,但无法获得任何数据:
foreach($theMovieData['images']['backdrops'][0]['vote_count'] as $key => $item) {
echo $item;
}
我会怎么做不正确的?我怎么会得到file_path找到最高的投票?
感谢您的帮助!
对'$ theMovieData ['images'] ['backdrops']'执行foreach。你试图在该数组中的整数上循环,而不是在数组元素上循环。 – 2013-03-15 20:29:37