/*
* 递归获取所有权限
*
* */
public function getTree ( $arr,$pid=0,$step=0,$except_id=false ) {
static $tree = [];
foreach ( $arr as $key=>$val ) {
//修改时,排除当前id的所有子类
if ( $val['id'] == $except_id ) {
continue;
}
//查找所有子分类
if ( $val['auth_pid'] == $pid ) {
$flg = str_repeat('***',$step);
$val['auth_name'] = $flg.$val['auth_name'];
$tree[] = $val;
$this->getTree($arr , $val['id'] ,$step+1,$except_id);
}
}
return $tree;
}
【精选秒杀】热卖云产品限量抢,云服务器20元/月起,服务稳定,价格更优
https://cloud.tencent.com/redirect.php?redirect=1039&cps_key=8ee0f9c89dfe0958071ea9b77e110670&from=console