当你确定想要的内容是树状结构时,以下代码是可以无脑套用的
需要更换的内容包括:数据表名称,查询条件及自定义函数的名称
当然我在放图片的下面有代码,可以直接复制,切记需要你自己渲染到模板,别自己不渲染说我代码不行
/*左侧开始*/ $where0='gc_id = 11'; $auth = Db::table('nqi_goodsclass')->where($where0)->find(); $where1 = 'gc_parent_id = '.$auth["gc_id"]; $auth_nextcontent=Db::table('nqi_goodsclass')->where($where1)->select()->toArray(); foreach ($auth_nextcontent as $k =>$v){ $auth_nextcontent[$k]['clild']=Db::table('nqi_goodsclass') ->where('gc_parent_id',$v["gc_id"]) ->select()->toArray(); } /*左侧结束*/,
&l