php面包屑导航

public function getFamily($cat_id){//获取面包屑导航
    $tree=array();
    $cats=$this->cats;

    while($cat_id>0){
        foreach($cats as $v){
            if($v['cat_id']==$cat_id){
                $tree[]=$v;
                $cat_id=$v['parent_id'];

            }
        }
    }

    return array_reverse($tree);
}
public function family($parent_id){//php更改family
    $trees=$this->getFamily($parent_id);
    
    $flag=true;
    foreach($trees as $v){
        if($v['cat_id']==I('get.cat_id')){
            $flag=false;
        }
    }
    return $flag;
}

}

你可能感兴趣的:(php)