【发布时间】:2014-03-03 07:20:27
【问题描述】:
好的,我正在使用codebird 使用 php 读写推文。这是一个受保护的推特帐户,因此我需要使用 API 在我们的专用网络上显示推文。我能够毫无问题地发布推文,它正在检索我们自己正在努力解决的推文。
$reply = (array) $cb->statuses_homeTimeline();
print_r($reply);
这给出了(这只是数组中的第一个)的输出
Array ( [0] => stdClass Object ( [created_at] => Thu Feb 06 09:08:43 +0000 2014 [id] => 431353751824134144 [id_str] => 431353751824134144 [text] => test 3 [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] => 2292936619 [id_str] => 2292936619 [name] => JPress Support [screen_name] => JPressSupport [location] => [description] => This is an automated account letting you know of any issues. Any tweets made to the account will not be seen. Thanks, Johnston Press IT. [url] => [entities] => stdClass Object ( [description] => stdClass Object ( [urls] => Array ( ) ) ) [protected] => 1 [followers_count] => 1 [friends_count] => 0 [listed_count] => 0 [created_at] => Wed Jan 15 16:11:20 +0000 2014 [favourites_count] => 0 [utc_offset] => 0 [time_zone] => Casablanca [geo_enabled] => [verified] => [statuses_count] => 3 [lang] => en-gb [contributors_enabled] => [is_translator] => [is_translation_enabled] => [profile_background_color] => C0DEED [profile_background_image_url] => http://abs.twimg.com/images/themes/theme1/bg.png [profile_background_image_url_https] => https://abs.twimg.com/images/themes/theme1/bg.png [profile_background_tile] => [profile_image_url] => http://pbs.twimg.com/profile_images/423490507906359297/t-ECTyZW_normal.png [profile_image_url_https] => https://pbs.twimg.com/profile_images/423490507906359297/t-ECTyZW_normal.png [profile_link_color] => 0084B4 [profile_sidebar_border_color] => C0DEED [profile_sidebar_fill_color] => DDEEF6 [profile_text_color] => 333333 [profile_use_background_image] => 1 [default_profile] => 1 [default_profile_image] => [following] => [follow_request_sent] => [notifications] => ) [geo] => [coordinates] => [place] => [contributors] => [retweet_count] => 0 [favorite_count] => 0 [entities] => stdClass Object ( [hashtags] => Array ( ) [symbols] => Array ( ) [urls] => Array ( ) [user_mentions] => Array ( ) ) [favorited] => [retweeted] => [lang] => et )
但是,如果我做类似的事情
<? echo $reply[0]; ?>
它没有输出。我猜这很简单,但我无法解决,请任何人帮忙,我只需要[text] =>的位
【问题讨论】:
-
请下次使用
print_r获取格式化输出的数组并发布。单线阵列难以阅读。 -
那是来自 print_r,这就是我挣扎的原因,它没有进行任何格式化,而且我以前从未见过这些对象
-
但是你不是从源代码视图中复制过来的?
-
不是,我是从Chrome的输出中复制过来的,源代码视图是什么意思?
-
如果您使用
print_r,则缩进有空格。普通的 view 不会显示它们。按 [CTRL] + [U] 打开页面的源代码视图。