0
我正在使用Vimeo API拉動我的vimeo相冊列表,並通過陣列循環三次以獲取相冊。它工作正常。按價值訂購陣列
我的問題是,我隔離日期,所以如何創建一個新的數組,並按日期排序?
雖然在那裏,有沒有辦法跳轉到多維數組的第三級?
$albums=$vimeo->call('vimeo.albums.getAll', array('user_id' => $myUserId));
$albums_array=object_2_array($albums);
foreach($albums_array as $album_array_two){
foreach($album_array_two as $album_array_three){
foreach($album_array_threeas $album){
if(stristr($album['title'],'conference')){
$title=$album['title'];
$description=$album['description'];
$date=stristr($album['description'],'.',true);
$year_comma=stristr($date,',');
$year=ereg_replace("[^0-9]", "", $year_comma);
$url_title='http://www.psfk.com/events/'.str_replace(" ", "-", strtolower($title));
$url='<a href="'.$url_title.'">'.$title.'</a>';
$thumb=$album['thumbnail_video']['thumbnails']['thumbnail'][1]['_content'];
echo '<li class="album">';
echo '<a href="'.$url_title.'"><img src="'.$thumb.'" alt="'.$title.'" /></a>';
echo '<div class="info">';
echo '<h2>'.$url.'</h2>';
echo $description.'<br />';
echo '<a href="'.$url_title.'">View...</a>';
echo '</div></li>';
}
}
}
}
樣品陣列返回一個項目:
Array (
[generated_in] => 0.0828
[stat] => ok
[albums] => Array (
[on_this_page] => 7
[page] => 1
[perpage] => 50
[total] => 7
[album] => Array (
[0] => Array (
[id] => 1690236
[title] => Interviews
[description] =>
[created_on] => 2011-09-10 21:43:49
[total_videos] => 1
[url] => Array (
[0] => http://vimeo.com/album/1690236
)
[video_sort_method] =>
[thumbnail_video] => Array (
[id] => 28825158
[owner] => 718882
[title] => Where Inspiration Comes From [thumbnails] => Array (
[thumbnail] => Array (
[0] => Array (
[height] => 75
[width] => 100
[_content] => http://b.vimeocdn.com/ts/192/593/192593029_100.jpg
)
)
)
)
)
)
)
)
你可以發表什麼樣的數組樣本?我很困惑,爲什麼有三個級別的專輯陣列 – bcoughlan
數組添加到問題。 – ok1ha