Tp5.0 无限级分类(分销系统)

    xiaoxiao2022-07-02  100

    public function getTree($pid){ static $arr=array(); $data=Db::table('yongh_zh')->where('tuij_id',$pid)->select(); foreach ($data as $key => $value) { if($value['tuij_id'] == $pid){ $arr[] = $value; $this->getTree($value['id']); } } return $arr; } public function tree() { $session=session::get(); $find=Db::table('yongh_zh')->where('id',$session['id'])->find(); //一级 $pid=$find['id']; $select=Db::table('yongh_zh')->where('tuij_id',$session['id'])->select(); //递归一级 return $this->getTree($pid); } public function arr(){ $arr=$this->tree(); $this->assign('arr',$arr); return view(); }
    最新回复(0)