function getTree($data, $pid){
$tree = '';
foreach($data as $k=>$v)
{
if($v['parentid']==$pid)
{
//print_r($this->getTree($data, $v['linkageid']));
$v['parentid'] = $this->getTree($data, $v['linkageid']);
$tree[] = $v;
}
}
return $tree;
}
以上就介绍了php把分类递归成数组,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。