从对象引入信息

时间:2015-11-02 16:40:51

标签: php

a有来自TwitterOAuth的对象

    stdClass Object
    (
        [statuses] => Array
            (
                [0] => stdClass Object
                    (
                        [metadata] => stdClass Object
                            (
                                [iso_language_code] => ar
                                [result_type] => recent
                            )

                        [created_at] => Wed Oct 28 07:03:04 +0000 2015
                        [id] => 659264098119626752
                        [id_str] => 659264098119626752
                        [text] => لا اله الا الله محمد رسول الله
    #فرح_غيرك_ب_كلمه   ...  الفرج قريب فاستعن بالله https://t.co/rBimtTqHjr
                        [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] => stdClass Object
                            (
                                [id] => 252266958
                                [id_str] => 252266958
                                [name] => mohamed tighoula
                                [screen_name] => honaalhal
                                [location] => 
                                [description] => مبرمج مسلم يهتم بشؤن البرمجة والحصريات في مجال الحاسوب والتدوين
                                [url] => http://t.co/4P3yVYJ7HP
                                [entities] => stdClass Object
                                    (
                                        [url] => stdClass Object
                                            (
                                                [urls] => Array
                                                    (
                                                        [0] => stdClass Object
                                                            (
                                                                [url] => http://t.co/4P3yVYJ7HP
                                                                [expanded_url] => http://hona-alhal.blogspot.com/
                                                                [display_url] => hona-alhal.blogspot.com
                                                                [indices] => Array
                                                                    (
                                                                        [0] => 0
                                                                        [1] => 22
                                                                    )

                                                            )

                                                    )

                                            )

                                        [description] => stdClass Object
                                            (
                                                [urls] => Array
                                                    (
                                                    )

                                            )

                                    )

                                [protected] => 
                                [followers_count] => 308
                                [friends_count] => 624
                                [listed_count] => 1
                                [created_at] => Mon Feb 14 21:07:05 +0000 2011
                                [favourites_count] => 4
                                [utc_offset] => 0
                                [time_zone] => Casablanca
                                [geo_enabled] => 
                                [verified] => 
                                [statuses_count] => 798
                                [lang] => ar
                                [contributors_enabled] => 
                                [is_translator] => 
                                [is_translation_enabled] => 
                                [profile_background_color] => C6E2EE
                                [profile_background_image_url] => http://abs.twimg.com/images/themes/theme2/bg.gif
                                [profile_background_image_url_https] => https://abs.twimg.com/images/themes/theme2/bg.gif
                                [profile_background_tile] => 
                                [profile_image_url] => http://pbs.twimg.com/profile_images/378800000491093887/03a7abcb2013a0bc589c4ed6890a94c7_normal.png
                                [profile_image_url_https] => https://pbs.twimg.com/profile_images/378800000491093887/03a7abcb2013a0bc589c4ed6890a94c7_normal.png
                                [profile_banner_url] => https://pbs.twimg.com/profile_banners/252266958/1379832476
                                [profile_link_color] => 1F98C7
                                [profile_sidebar_border_color] => C6E2EE
                                [profile_sidebar_fill_color] => DAECF4
                                [profile_text_color] => 663B12
                                [profile_use_background_image] => 1
                                [has_extended_profile] => 
                                [default_profile] => 
                                [default_profile_image] => 
                                [following] => 
                                [follow_request_sent] => 
                                [notifications] => 
                            )

                        [geo] => 
                        [coordinates] => 
                        [place] => 
                        [contributors] => 
                        [is_quote_status] => 
                        [retweet_count] => 0
                        [favorite_count] => 0
                        [entities] => stdClass Object
                            (
                                [hashtags] => Array
                                    (
                                        [0] => stdClass Object
                                            (
                                                [text] => فرح_غيرك_ب_كلمه
                                                [indices] => Array
                                                    (
                                                        [0] => 31
                                                        [1] => 47
                                                    )

                                            )

                                    )

    )

我试试这个H

我的代码是

echo $statuses->statuses->followers_count;

1 个答案:

答案 0 :(得分:0)

我试过这个并且有效

$statuses->statuses[0]->user->followers_count

John Conde&&马格努斯埃里克森