时间:2021-07-01 10:21:17 帮助过:22人阅读
你这里不需要子id,有父id就行啦,你根据classid查询子id就行了
有父id,featherclass=classid,就能到到classid的下级
你这是想做什么??
有父id,featherclass=classid,就能到到classid的下级
$class = $this->tclass->get_all_class($this->tbname); $json_class = Array(); $json_class2 = array(); foreach ($class as $key=>$value) { if($class[$key]['sonclass']) //如果有子分类 { $json_class[$key]['id'] = $value['classid']; $json_class[$key]['text'] = $value['classname']; $son_arr = $this->tclass->get_son_class($value['sonclass'],$this->tbname); foreach ($son_arr as $k=>$v) { $json_class1[$k]['id'] = $v['classid']; $json_class1[$k]['text'] = $v['classname']; } $json_class[$key]['children'] = $json_class1; } }