显示来自json解码数组的文本

时间:2014-07-03 08:15:37

标签: php json api rest twitter

  Array
(
    [statuses] => Array
        (
            [0] => Array
                (
                    [metadata] => Array
                        (
                            [result_type] => recent
                            [iso_language_code] => en
                        )

                    [created_at] => Thu Jul 03 08:06:24 +0000 2014
                    [id] => 484609084809687043
                    [id_str] => 484609084809687043
                    [text] => RT @RashtrapatiBhvn: #Rains at the #RashtrapatiBhavan http://t.co/w1imlVFbHe
                    [source] => Twitter Web Client
                    [truncated] => 
                    [in_reply_to_status_id] => 
                    [in_reply_to_status_id_str] => 
                    [in_reply_to_user_id] => 
                    [in_reply_to_user_id_str] => 
                    [in_reply_to_screen_name] => 
                    [user] => Array
                        (
                            [id] => 1620882618
                            [id_str] => 1620882618
                            [name] => HinduNationalist#HDL
                            [screen_name] => hinduwarrior15
                            [location] => HINDUSTAN
                            [description] => I want  India to become a exclusive  Hindurashtra. Want a HINDUSTAN by hindus for hindus and to hindus. HINDU NATIONALIST.. #HDL
                            [url] => http://t.co/hWAAfdlWMX
                            [entities] => Array
                                (
                                    [url] => Array
                                        (
                                            [urls] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [url] => http://t.co/hWAAfdlWMX
                                                            [expanded_url] => http://www.hdlindia.org/
                                                            [display_url] => hdlindia.org
                                                            [indices] => Array
                                                                (
                                                                    [0] => 0
                                                                    [1] => 22
                                                                )

                                                        )

                                                )

                                        )

这是我通过调用Twitter API获得的典型结果,但我只想显示此ID和文本。我已经使用json_decode方法解码了传入的json结果。

我从未使用过json字符串,如果有人可以提供帮助,那就太棒了

请帮忙

1 个答案:

答案 0 :(得分:0)

$yourArray['statuses'][0]['id']$yourArray['statuses'][0]['text']可以解决问题。

相关问题