public function CategoryList(){
$all_date = static::find()->asArray()->all();
return $this->getTree($all_date, 0, 0);
}
public function getTree($date, $parent_id, $deep){
static $ar = [];
foreach($date as $key => $value){
if($value['parent_id'] == $parent_id){
$value['deep'] = $deep;
$ar[] = $value;
$this->getTree($date, $value['id'], $deep+1);
}
}
return $ar;
}
无限极分类
最新推荐文章于 2023-11-28 16:55:14 发布