Php 如何处理/使用Twitter API';什么是stdClass对象?
等等,你不需要阅读全部内容:)只要向下滚动,看看我问了什么Php 如何处理/使用Twitter API';什么是stdClass对象?,php,twitter,Php,Twitter,等等,你不需要阅读全部内容:)只要向下滚动,看看我问了什么 stdClass Object ( [friends_count] => 54 [description] => i'TS THE digiTAL vERSiOn 0b devilZ! tECH & mUUsic fReak. sImpLE buT.......! [screen_name] => 2020Volt [profile_sidebar_borde
stdClass Object
(
[friends_count] => 54
[description] => i'TS THE digiTAL vERSiOn 0b devilZ! tECH & mUUsic fReak.
sImpLE buT.......!
[screen_name] => 2020Volt
[profile_sidebar_border_color] => 181A1E
[status] => stdClass Object
(
[in_reply_to_user_id_str] => 83300174
[place] =>
[coordinates] =>
[contributors] =>
[in_reply_to_screen_name] => Anik1990
[geo] =>
[retweet_count] =>
[source] => Seesmic Web
[retweeted] =>
[in_reply_to_status_id] => 29180026185
[created_at] => Sat Oct 30 13:04:53 +0000 2010
[in_reply_to_user_id] => 83300174
[truncated] =>
[in_reply_to_status_id_str] => 29180026185
[id] => 29181306201
[id_str] => 29181306201
[favorited] =>
[text] => @Anik1990 its just my point of view man.....
)
[geo_enabled] => 1
[follow_request_sent] =>
[time_zone] => Dhaka
[favourites_count] => 1
[verified] =>
[notifications] =>
[profile_background_color] => 1A1B1F
[url] => http://techysafi.wordpress.com
[lang] => en
[profile_use_background_image] => 1
[created_at] => Tue Sep 21 15:28:38 +0000 2010
[profile_text_color] => 666666
[location] => Dhaka,Bangladesh[listed_count] => 6
[protected] =>
[statuses_count] => 1962
[profile_background_image_url] => http://s.twimg.com/a/1288217225/images/themes/theme9/bg.gif
[profile_link_color] => 2FC2EF
[name] => Tech Freak Satan
[show_all_inline_media] =>
[following] =>
[profile_image_url] => http://a1.twimg.com/profile_images/1146520409/SDC11078_normal.jpg
[id] => 193332358
[id_str] => 193332358
[contributors_enabled] =>
[profile_background_tile] =>
[utc_offset] => 21600
[profile_sidebar_fill_color] => 252429
[followers_count] => 60
)
现在我的问题是如何将[text]转换为$tweet这样的变量??还有[名字]。因为我想将它们存储在mysql上,所以我需要检索[text]&[name]的值
$sdjkf->状态->文本;这不是退货
我在这里看到了一个相关的帖子,但我的情况有点不同。只要浏览这个链接,如果你愿意的话
(我请求你原谅,请不要把我当作一个专业人士,所以无论你说什么,都要说得完整清楚……我知道我很愚蠢:-)
提前感谢假设将
stdClass
对象(如上所列)存储在名为$response
的php变量中,您可以将text
属性放入名为$tweet
的php变量中,如下所示:
$tweet = $response->status->text;
同样,名称为:
$tweeter_name = $response->screen_name;
您可以使用foreach()
foreach($tweet as $value)
{echo "Screen Name : ".$value->screen_name."<br>";
echo "Tweet : ". $value->text."<br>";
}
foreach($tweet作为$value)
{echo“屏幕名称:”.$value->Screen_Name.
”;
回声“Tweet:”.$value->文本。“
”;
}