如何呼应PHP中的数组? [英] How to echo an array in PHP?

查看:107
本文介绍了如何呼应PHP中的数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的阵列

 阵列

  [数据] =>排列
    (
      [0] =>排列
        (
          [PAGE_ID] => 204725966262837
          [类型] = GT;网站
        )      [1] =>排列
        (
          [PAGE_ID] => 163703342377960
          [类型] = GT;社区
        )
      )

我的问题是如何才能不回应这个结构的内容?我试过

 的foreach($结果$结果){
    回声$ result->类型;
    回声< BR>中;
}


解决方案

这将做

 的foreach($结果['数据']为$结果){
回声$结果[型],'< BR>';
}

I have this array

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>";
} 

解决方案

This will do

foreach($results['data'] as $result) {
    echo $result['type'], '<br>';
}

这篇关于如何呼应PHP中的数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆