我使用此代码获取有关推文的许多信息
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET);
$tw_get=$connection->get('statuses/user_timeline', array('screen_name' => $tw_usr, 'count' => 1));
如何打印数组就像这个例子:
[id_str] => xxxxxxxxxxxxxxxxxx
[created_at] => Thu May 10 14:08:36 +0000 2012
[recipient_screen_name] => Infobot2012
[recipient_id] => xxxxxxxx
[sender_id] => xxxxxxxx
[recipient] => stdClass Object
(
[id] => xxxxxxxx
[id_str] => xxxxxxxx
[default_profile] => 1
[profile_use_background_image] => 1
[location] =>
[statuses_count] => 11
[following] =>
[utc_offset] =>
[profile_sidebar_border_color] => C0DEED
[listed_count] => 0
)
[text] => test
)
因为它的打印方式如下:
stdClass对象([created_at] => Fri Sep 01 16:10:42 +0000 2017 [id] => 9.0365133846191E + 17 [id_str] => 903651338461908997 [text] => RT @SonyMobileNews:使用Xperia XZ1进行Engadget实践 - 包括3D Creator,预测捕获和更多youtube.com [truncated] => [entities] => stdClass对象([hashtags] => Array()[symbols] =>数组()[user_mentions] =>数组([0] => stdClass对象([screen_name] => SonyMobileNews [name] => Sony Xperia新闻[id] => 70888891 [id_str] => 70888891 [ indices] =>数组([0] => 3 [1] => 18)))[urls] =>数组([0] => stdClass对象([url] => youtube.com [expanded_url] => https://www.youtube.com/watch?v=KIOBponXMkY [display_url] =>youtube.com/watch?v=KIOBpoâу|[indices] =>数组([0] => 105 [1] => 128 ))))
答案 0 :(得分:0)
使用<pre>
假设你的数组是$your_array
代码:
echo '<pre>';
var_dump($your_array);
echo '</pre>';