2017-09-01 102 views
0

我使用此代碼獲取有關鳴叫打印通過php從twitter獲取的數組?

$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 Object([created_at] => Fri Sep 01 16:10:42 +0000 2017 [id] => 9.0365133846191E + 17 [id_str] => 903651338461908997 [text] => RT @SonyMobileNews:Engadget動手實踐Xperia XZ1 - inc (數組)[] []數組([數組])[] [數組]()[數組] => stdClass Object([screen_name] => SonyMobileNews [name] => Sony Xperia News [id] => 70888891 [id_str] => 70888891 [indices] => Array([0] => 3 [1] => 18 ))[url] => Array([0] => stdClass Object([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
使用

<pre> asuming您的陣列是$your_array代碼將是:

echo '<pre>'; 
var_dump($your_array); 
echo '</pre>'; 
+0

非常感謝:) – engnajjar

+0

當然:),打印不是100%,因爲我需要它在每個項目之前添加「公共」,而不是像我想要的那樣:「[id_str] =>」 如何解決這個問題請 ?? – engnajjar