where("p">
时间:2021-07-01 10:21:17 帮助过:13人阅读
public function _getMenu($id=0,$t=0){
$category = M("category");
$data = $category->where("pid=$id")->order("sort asc")->select();
if($data){
$t++;
$data2['leavel'] = $t;
$category->where("pid=$id")->save($data2); //层级
foreach($data as $key=>$value){
$sort = $value['sort'];
$id = $value['id'];
$this->str .= ''; ';
$this->str .= "". $value['id']." ";
if($t>1){
if()
$this->str .= "|-----".$value['name']." ";
}else{
$this->str .= "".$value['name']." ";
}
$this->str .= "".$value['group']." ";
$id = $value['id'];
$this->str .= '删除
$this->_getMenu($value['id'],$t);
}
}
}