我是 PHP 新手,所以这可能是个愚蠢的问题,但我试图自己弄清楚但没有成功。我正在尝试使用 Zend Framework 从 Twitter 获取一些信息,这是响应:
[jsonBody:protected] => Array
(
[0] => stdClass Object
(
[created_at] => Sat Jun 15 08:30:00 +0000 2013
[id] => 3.4582047273635E+17
[id_str] => 345820472736354304
[text] => In Saturday Flashback, watch #FFC take a huge step towards the Premier League with a vital win at Blackburn in 2001. http://t.co/iRWPDg7NmK
[source] => web
[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] => 22903812
[id_str] => 22903812
[name] => Fulham Football Club
[screen_name] => FulhamFC
[location] => Fulham, London, England
[description] => The Official Twitter page of Fulham Football Club, London, England. http://t.co/GWMBbvhEfT #ffc #fulhamfc #coyw #bytheriver
[url] => http://t.co/qHWTVnXr2E
[entities] => stdClass Object
(
[url] => stdClass Object
(
[urls] => Array
(
[0] => stdClass Object
(
[url] => http://t.co/qHWTVnXr2E
[expanded_url] => http://www.fulhamfc.com
[display_url] => fulhamfc.com
[indices] => Array
(
[0] => 0
[1] => 22
)
)
)
)
[description] => stdClass Object
(
[urls] => Array
(
[0] => stdClass Object
(
[url] => http://t.co/GWMBbvhEfT
[expanded_url] => http://fulhamfc.com
[display_url] => fulhamfc.com
[indices] => Array
(
[0] => 68
[1] => 90
)
)
)
)
)
[protected] =>
[followers_count] => 139667
[friends_count] => 12662
[listed_count] => 2083
[created_at] => Thu Mar 05 10:10:44 +0000 2009
[favourites_count] => 16
[utc_offset] => 0
[time_zone] => London
[geo_enabled] =>
[verified] => 1
[statuses_count] => 11680
[lang] => en
[contributors_enabled] =>
[is_translator] =>
[profile_background_color] => 000000
[profile_background_image_url] => http://a0.twimg.com/profile_background_images/837307227/ac1a6a4096d1b8cda9276d169b57b889.jpeg
[profile_background_image_url_https] => https://si0.twimg.com/profile_background_images/837307227/ac1a6a4096d1b8cda9276d169b57b889.jpeg
[profile_background_tile] =>
[profile_image_url] => http://a0.twimg.com/profile_images/3178979663/5ef1b3abec0dec9e160491cb62c835f5_normal.jpeg
[profile_image_url_https] => https://si0.twimg.com/profile_images/3178979663/5ef1b3abec0dec9e160491cb62c835f5_normal.jpeg
[profile_banner_url] => https://pbs.twimg.com/profile_banners/22903812/1348050191
[profile_link_color] => 0084B4
[profile_sidebar_border_color] => FFFFFF
[profile_sidebar_fill_color] => DDEEF6
[profile_text_color] => 333333
[profile_use_background_image] => 1
[default_profile] =>
[default_profile_image] =>
[following] =>
[follow_request_sent] =>
[notifications] =>
)
[geo] =>
[coordinates] =>
[place] =>
[contributors] =>
[retweet_count] => 9
[favorite_count] => 5
[entities] => stdClass Object
(
[hashtags] => Array
(
[0] => stdClass Object
(
[text] => FFC
[indices] => Array
(
[0] => 29
[1] => 33
)
)
)
[symbols] => Array
(
)
[urls] => Array
(
[0] => stdClass Object
(
[url] => http://t.co/iRWPDg7NmK
[expanded_url] => http://ow.ly/m3Ljl
[display_url] => ow.ly/m3Ljl
[indices] => Array
(
[0] => 117
[1] => 139
)
)
)
[user_mentions] => Array
(
)
)
[favorited] =>
[retweeted] =>
[possibly_sensitive] =>
[lang] => en
)
)
我没有找到访问数据的方法,将对象转换为数组不起作用,直接作为对象访问也不起作用。请指教。
例如:
echo $response['0']['text'];
echo $response->0->text;