You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
390 B
PHP
24 lines
390 B
PHP
<?php
|
|
|
|
namespace app\admin\model;
|
|
use think\Db;
|
|
use think\Model;
|
|
class Sys_menu extends Model
|
|
{
|
|
public function catetree(){
|
|
$cateres=$this->select();
|
|
return $this->sort($cateres);
|
|
}
|
|
public function sort($data,$pid=0,$level=0){
|
|
static $arr=array();
|
|
foreach ($data as $k =>$v){
|
|
if($v['pid']==$pid){
|
|
$v['level']=$level;
|
|
$arr[]=$v;
|
|
$this->sort($data,$v['id'],$level+1);
|
|
}
|
|
}
|
|
return $arr;
|
|
}
|
|
}
|
|
?>
|