好的,所以数组是我的弱点,我正在为此苦苦挣扎。这可能也很简单。基本上,我有一个数组
代码:
Array
(
[data] => Array
(
[0] => Array
(
[name] => getalbum
[fql_result_set] => Array
(
[0] => Array
(
[aid] => 187046464639937_101906
[name] => photo tab
[cover_pid] => 187046464639937_1661168
)
[1] => Array
(
[aid] => 187046464639937_99627
[name] => Cover Photos
[cover_pid] => 187046464639937_1661054
)
)
)
[1] => Array
(
[name] => getcover
[fql_result_set] => Array
(
[0] => Array
(
[src] => http://photos-g.ak.fbcdn.net/hphotos-ak-prn1/526499_403098366368078_187046464639937_1661168_217706037_s.jpg
)
[1] => Array
(
[src] => http://photos-b.ak.fbcdn.net/hphotos-ak-ash3/562470_403049039706344_187046464639937_1661054_361917190_s.jpg
)
)
)
)
)
我正在使用 foreach 通过 PHP 代码调用数组:
foreach($fql_query_obj['data'] as $albums){
foreach($albums['fql_result_set'] as $album){
//print_r($album);
if ( ($album['name'] != "Wall Photos")
&& ($album['name'] != "Cover Photos")
&& ($album['name'] != "photo tab"))
{
echo $album['name'].' :: '.$album['aid'];
echo '<img src="'.$album['src'].'" /><br />';
}
}
}
现在它似乎通过 getalbum 数组然后是 getcover。我该怎么做才能将它们合并在一起?