Twitter api php foreach循环不适用于用户推文
我正在使用twitter api php abraham Library,我正在尝试循环浏览用户的推文,但我遇到了麻烦 我正在使用这个从家庭时间线上获取所有用户的推文Twitter api php foreach循环不适用于用户推文,php,twitter,tweets,tweetstream,Php,Twitter,Tweets,Tweetstream,我正在使用twitter api php abraham Library,我正在尝试循环浏览用户的推文,但我遇到了麻烦 我正在使用这个从家庭时间线上获取所有用户的推文 $content = $connection->get('statuses/home_timeline'); echo '<pre>',print_r($content),'</pre>'; 如何使用forech循环从std类对象获取名称 我尝试过这个,但它不起作用 foreach($conten
$content = $connection->get('statuses/home_timeline');
echo '<pre>',print_r($content),'</pre>';
如何使用forech循环从std类对象获取名称
我尝试过这个,但它不起作用
foreach($content as $tweets) {
foreach($tweets['user'] as $user) {
echo $user['name'] . '<br />';
}
}
foreach($content['user']作为$tweets){
echo$tweets['name']。
;
}
任何帮助都是好的:)你需要做的就是这样
foreach($content as $tweets) {
echo $tweets->user->name . '<br />';
echo $tweets->text . '<br />';
}
foreach($tweets内容){
foreach($tweets['user']作为$user){
echo$user['name'].
;
}
}
好的,这似乎奏效了。谢谢你的帮助
foreach($tweets内容){
echo$tweets->user->name.“
”;
echo$tweets->text.“
”;
}
谢谢……但我刚刚尝试过,但没有成功:(……我需要循环[created_at][text]和user->[name]……因为它是一个stdclass对象,我需要循环$key值吗?如果需要,我该怎么做??:(
foreach($content as $tweets) {
foreach($tweets['user'] as $user) {
echo $user['name'] . '<br />';
}
}
foreach($content as $tweets) {
echo $tweets->user->name . '<br />';
echo $tweets->text . '<br />';
}