douzhoubing2805 2017-07-06 06:41
浏览 77

如何从这样的数组导航和获取信息

Im trying to navigate and fetch info from this array but im not having much success any tips? This is an decoded JSON from Twitter API

I tryed echo $array->statuses[0]->created_at; and it did not work, am i doing something wrong here?

Array
    (
        [statuses] => Array
            (
                [0] => stdClass Object
                    (
                        [created_at] => Thu Jul 06 04:05:06 +0000 2017
                        [id] => 882812623959584768
                        [id_str] => 882812623959584768
                        [text] => RT @blackdragonsBR: [R6] GG!! Fechamos o mapa Banco por 5x2 e conquistamos a liderança no #ALIENWARENOIGN #GOBD #Acer #Predator https://t.c…
                        [truncated] => 
                        [entities] => stdClass Object
                            (
                                [hashtags] => Array
                                    (
                                        [0] => stdClass Object
                                            (
                                                [text] => ALIENWARENOIGN
                                                [indices] => Array
                                                    (
                                                        [0] => 90
                                                        [1] => 105
                                                }

                                        )
                                }
                        }
                }
        }
}
  • 写回答

2条回答 默认 最新

  • dtr84664 2017-07-06 06:48
    关注

    You need to access the array by [] not ->. So change the access of statuses like below

    $array[statuses][0]->created_at;
    
    评论

报告相同问题?

悬赏问题

  • ¥15 目详情-五一模拟赛详情页
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line