我正在使用 twitter api php abraham 库,我正在尝试遍历用户的推文,但我遇到了麻烦。
我正在使用这个从主时间线获取所有用户的推文。
$content = $connection->get('statuses/home_timeline');
echo '<pre>',print_r($content),'</pre>';
如果我打印出数组...我明白了。
Array ( [0] => stdClass Object ( [created_at] => Tue Feb 10 15:31:07 +0000 2015 [id] => 565171109470171136 [id_str] => 565171109470171136 [text] => We are human beings not human doings – let’s start acting like it & take the time simply to be http://t.co/i4HAnApQxp http://t.co/3qSXA4D1qY [source] => Hootsuite [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] => 8161232 [id_str] => 8161232 [name] => Richard Branson [screen_name] => richardbranson [location] => [profile_location] => [description] => Tie-loathing adventurer, philanthropist & troublemaker, who believes in turning ideas into reality. Otherwise known as Dr Yes at @virgin! [url] => http://t.co/pWM2y98gTu [entities] => stdClass Object (
我如何使用 forech 循环从 std 类对象中获取名称?
我已经尝试过了,但它不起作用??
foreach($content['user'] as $tweets) {
echo $tweets['name'] . '<br />';
}
任何帮助都会很好:)