function getTree($data, $pId)
{
$html = '';
foreach($data as $k => $v)
{
if($v['cate_ParentId'] == $pId)
{ //父亲找到儿子
$html .= "<li>".$v['cate_Name'];
$html .= getTree($data, $v['cate_Id']);
$html = $html."</li>";
}
}
return $html ? '<ul>'.$html.'</ul>' : $html ;
}
echo getTree($data, 0);
网友评论