如何在 PHP 中回显或打印数组?
问题描述:
我有这个数组
Array
(
[data] => Array
(
[0] => Array
(
[page_id] => 204725966262837
[type] => WEBSITE
)
[1] => Array
(
[page_id] => 163703342377960
[type] => COMMUNITY
)
)
)
我的问题是如何在没有这种结构的情况下回显内容?我试过
My question is how can I just echo the content without this structure? I tried
foreach ($results as $result) {
echo $result->type;
echo "<br>";
}
答
这就行了
foreach($results['data'] as $result) {
echo $result['type'], '<br>';
}