嘿,我想從電影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