【发布时间】:2013-10-03 16:37:24
【问题描述】:
我是 php 新手,正在尝试从 twitter api 读取 text 和 description。我的数组看起来像:
Array
(
[0] => stdClass Object
(
[created_at] => Thu Oct 03 14:50:55 +0000 2013
[id] => 3.85778998506E+17
[id_str] => 385778998506033154
[text] => We tested live-tweeting with @MLB to see if teams could boost follower engagement and their Twitter audience: https://t.co/XPhHmVDNxJ
[source] => TweetDeck
[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] => 783214
[id_str] => 783214
[name] => Twitter
[screen_name] => twitter
[location] => San Francisco, CA
[description] => Your official source for news, updates and tips from Twitter, Inc.
[url] => http://t.co/5iRhy7wTgu
[entities] => stdClass Object
我尝试这样阅读,但无法打印任何内容echo $tweets->text;
【问题讨论】:
-
如果$tweets是一个数组,不应该是$tweets[0]->text;
标签: php arrays arrayobject