我有一個從捲曲API來到這個多維數組:PHP的多維數組提取
Array
(
[status] => 200
[message] => Success
[info] => Array
(
[NewRegUsers] => 0
[TotRegUsers] => 6
[shows] => Array
(
[0] => Array
(
[keyword] => BANANA
[entries] => 1
)
[1] => Array
(
[keyword] => CHRISTMAS
[entries] => 1
)
[2] => Array
(
[keyword] => CONCERT
[entries] => 1
)
[3] => Array
(
[keyword] => EXTRA
[entries] => 1
)
)
)
)
我試圖得到NewRegUsers,TotRegUsers值和值[shows]
並獲得關鍵字和條目。我用這個代碼:
foreach($data['info'] as $value)
{
foreach ($value as $item){
$shows .= ' <tr>
<td class="col1">'.$x.'. '.$item['keyword'].'</th>
<td>'.$item['entries'].'</td>
</tr>';
$x ++ ;
}
}
我仍然對數組感到困惑。 :(
的可能的複製[?我怎樣才能訪問數組/對象(http://stackoverflow.com/questions/30680938/how-can-i-access-an -array-object) –