public static function get_attr($a,$pid){
$tree = array();
foreach($a as $v){
if($v['parent_id'] == $pid){
$v['children'] = self::get_attr($a,$v['comment_id']);
if($v['children'] == null){
unset($v['children']);
}
$tree[] = $v;
}
}
return $tree;
}
php 父id循环
最新推荐文章于 2024-07-13 13:55:40 发布