标签:blog io ar for on div log cti as
function arPro($data,$res=array(),$pid=‘0‘,$level=‘0‘){ foreach ($data as $k => $v){ if($v[‘comment_parent‘]==$pid){ $res[$v[‘id‘]][‘info‘]=$v; if($level!=‘0‘){ if($v[‘level‘]==$level){ $child=null; } else{ $child=arPro($data,array(),$v[‘comment_id‘],$level+1); } $res[$v[‘id‘]][‘child‘]=$child; } else{ $child=arPro($data,array(),$v[‘comment_id‘]); if($child==‘‘||$child==null){ $res[$v[‘id‘]][‘child‘]=null; } else{ $res[$v[‘id‘]][‘child‘]=$child; } } } } return $res; }
标签:blog io ar for on div log cti as
原文地址:http://www.cnblogs.com/qiandu/p/4122533.html