dtz8044 2017-09-01 21:30
浏览 13

打印从twitter通过PHP获取的数组? [重复]

This question already has an answer here:

I use this code to get many information about the a tweet

$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));

how can I print the array to be like this example :

        [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
)

because it's printed like this :

stdClass Object ( [created_at] => Fri Sep 01 16:10:42 +0000 2017 [id] => 9.0365133846191E+17 [id_str] => 903651338461908997 [text] => RT @SonyMobileNews: Engadget hands-on with Xperia XZ1 - includes 3D Creator, Predictive Capture and more youtube.com [truncated] => [entities] => stdClass Object ( [hashtags] => Array ( ) [symbols] => Array ( ) [user_mentions] => Array ( [0] => stdClass Object ( [screen_name] => SonyMobileNews [name] => Sony Xperia News [id] => 70888891 [id_str] => 70888891 [indices] => Array ( [0] => 3 [1] => 18 ) ) ) [urls] => Array ( [0] => stdClass Object ( [url] => youtube.com [expanded_url] => https://www.youtube.com/watch?v=KIOBponXMkY [display_url] => youtube.com/watch?v=KIOBpo… [indices] => Array ( [0] => 105 [1] => 128 ) ) ) )

</div>
  • 写回答

1条回答 默认 最新

  • dsf1222 2017-09-01 21:33
    关注

    use <pre> asuming your array is $your_array the code would be:

    echo '<pre>';
    var_dump($your_array);
    echo '</pre>';
    
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#网络安全#的问题:求ensp的网络安全,不要步骤要完成版文件
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥20 使用Photon PUN2解决游戏得分同步的问题
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序