public static function getScience($type)
{
$data = self::where('type',$type)->select();
return self::getTree($data,0);
}
public static function getTree($data,$pid)
{
$result = [];
if ($data){
foreach ($data as $vo){
if ($vo['pid'] == $pid){
$vo['info'] = self::getTree($data,$vo['id']);
$result[] = $vo;
}
}
return $result;
}
}
实现接口层级调用
于 2023-04-03 14:52:35 首次发布