如何在PHP中回显或打印数组? [英] How to echo or print an array in PHP?
本文介绍了如何在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>';
}
这篇关于如何在PHP中回显或打印数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文