嘿,我想从电影API中获取数据。格式是这样的:PHP获取第一个数组元素
page => 1
results =>
0 =>
adult =>
backdrop_path => /gM3KKixSicG.jpg
id => 603
original_title => The Matrix
release_date => 1999-03-30
poster_path => /gynBNzwyaioNkjKgN.jpg
popularity => 10.55
title => The Matrix
vote_average => 9
vote_count => 328
1 =>
adult =>
backdrop_path => /o6XxGMvqKx0.jpg
id => 605
original_title => The Matrix Revolutions
release_date => 2003-10-26
poster_path => /sKogjhfs5q3aEG8.jpg
popularity => 5.11
title => The Matrix Revolutions
vote_average => 7.5
vote_count => 98
etc etc....
我怎样才能只有第一元件[0]的数据(如在backdrop_path,ORIGINAL_TITLE,等等等等)?我是新的PHP阵列:)。
当然,这并是我用来输出我的阵列数据:
print_r($theMovie)
任何帮助将是巨大的!
是'...-> results [0]'好吗? – Voitcus 2013-03-15 16:07:34
你似乎在回答你自己的问题... $ theMovie [“results”] [0]? – cernunnos 2013-03-15 16:08:00
请参阅http://stackoverflow.com/questions/1921421/get-the-first-element-of-an-array/24802579#24802579 – 2014-07-18 18:19:03