">
时间:2021-07-01 10:21:17 帮助过:32人阅读
创建数据库表:tb_cate:id,name,pid,path
action
field("id,name,pid,path,concat(path,'-',id) as bpath")->order("bpath")->select();
foreach ($list as $key=>$value){
$list[$key]['count']=count(explode('-', $value['bpath']));
}
$this->assign('alist',$list);
$this->display();
}
function add(){
//经过自定义模型
$cate=D('Cate');
if ($vo=$cate->create()) {
dump($vo);
if ($cate->add()){
$this->success("注册成功");
}else{
$this->error($cate->getError());
}
}else{
$this->error($cate->getError());
}
}
}
?>where('id='.$pid)->find();
$path=$pcate['path'].'-'.$pcate['id'];
return $path;
}
}
?>