函数定义: 

  1. //@patten:为打印前的字符串,不同的层次会增加该串打印的次数 
  2. //@array:为要打印的数组 
  3. function print_array($patten$array){ 
  4.   $retstr
  5.   foreach($array as $value){ 
  6.     ifis_array($value) ){ 
  7.       $patten = $patten.$patten
  8.       print_array($patten$value); 
  9.     } else { 
  10.       echo "<p>".$patten."[".key($array)."]".": ".$value." <br/> ""</p>"
  11.     } 
  12.   next($array); 
  13.   } 

调用方法: 

  1. print_array("-"$array); 

输出,打印sina微博: 

-[created_at]: Sun Mar 25 16:35:50 +0800 2012

-[id]: 3427505904478654

-[mid]: 3427505904478654

-[idstr]: 3427505904478654

-[text]: 转发。

-[source]: iPhone客户端

-[favorited]:

-[truncated]:

-[in_reply_to_status_id]:

-[in_reply_to_user_id]:

-[in_reply_to_screen_name]:

-[geo]:

-[user]:

--[id]: 1721825977

--[idstr]: 1721825977

--[screen_name]: 许小年

--[name]: 许小年

--[province]: 11

--[city]: 1000

--[location]: 北京

--[description]:

--[url]: http://blog.sina.com.cn/xuxiaonian

--[profile_p_w_picpath_url]: http://tp2.sinaimg.cn/1721825977/50/1270102276/1

--[profile_url]: xuxiaonian

--[domain]: xuxiaonian

--[weihao]:

--[gender]: m

--[followers_count]: 3220389

--[friends_count]: 102

--[statuses_count]: 2249

--[favourites_count]: 489

--[created_at]: Thu Apr 01 00:00:00 +0800 2010

--[following]: 1

--[allow_all_act_msg]:

--[geo_enabled]: 1

--[verified]: 1

--[verified_type]: 0

--[remark]:

--[allow_all_comment]: 1

--[avatar_large]: http://tp2.sinaimg.cn/1721825977/180/1270102276/1

--[verified_reason]: 中欧国际工商学院经济学与金融学教授 许小年

--[follow_me]:

--[online_status]: 1

--[bi_followers_count]: 85

--[lang]: zh-cn

--[retweeted_status]:

----[created_at]: Sun Mar 25 15:14:44 +0800 2012

----[id]: 3427485494637159

----[mid]: 3427485494637159

----[idstr]: 3427485494637159

----[text]: 【观点·吴敬琏:中经济矛盾社会矛盾几乎到临界点】目前国家权力对市场的干预,对价格管控,造成很大权力寻租空间,腐败蔓延不能有效制止。这也同时带来经济问题社会问题变成了政治问题。1992年已明确的顶层设计是市场经济改革,可如今人们数典忘祖,忘了这个改革目标——今日,吴敬琏在岭南论坛表示。

----[source]: 新浪微博

----[favorited]:

----[truncated]:

----[in_reply_to_status_id]:

----[in_reply_to_user_id]:

----[in_reply_to_screen_name]:

----[thumbnail_pic]: http://ww3.sinaimg.cn/thumbnail/61e04755jw1drc2dpro6fj.jpg

----[bmiddle_pic]: http://ww3.sinaimg.cn/bmiddle/61e04755jw1drc2dpro6fj.jpg

----[original_pic]: http://ww3.sinaimg.cn/large/61e04755jw1drc2dpro6fj.jpg

----[geo]:

----[user]:

--------[id]: 1642088277

--------[idstr]: 1642088277

--------[screen_name]: 财经网

--------[name]: 财经网

--------[province]: 11

--------[city]: 5

--------[location]: 北京 朝阳区

--------[description]: 价值观决定影响力——《财经网》; 与您共同 “微观”这个时代的方方面面——《财经网微博》。

--------[url]: http://www.caijing.com.cn/

--------[profile_p_w_picpath_url]: http://tp2.sinaimg.cn/1642088277/50/1283204216/1

--------[profile_url]: caijing

--------[domain]: caijing

--------[weihao]:

--------[gender]: m

--------[followers_count]: 2069308

--------[friends_count]: 1405

--------[statuses_count]: 35761

--------[favourites_count]: 48

--------[created_at]: Fri Aug 28 00:00:00 +0800 2009

--------[following]:

--------[allow_all_act_msg]:

--------[geo_enabled]: 1

--------[verified]: 1

--------[verified_type]: 3

--------[remark]:

--------[allow_all_comment]: 1

--------[avatar_large]: http://tp2.sinaimg.cn/1642088277/180/1283204216/1

--------[verified_reason]: 财经网官方微博

--------[follow_me]:

--------[online_status]: 0

--------[bi_followers_count]: 835

--------[lang]: zh-cn

--------[reposts_count]: 2721

--------[comments_count]: 562

--------[mlevel]: 0

--------[visible]:

----------------[type]: 0

----------------[list_id]: 0

----[reposts_count]: 756

----[comments_count]: 190

----[mlevel]: 0

----[visible]:

--------[type]: 0

--------[list_id]: 0