4,251
社区成员
发帖
与我相关
我的任务
分享
protected $_model;
public function __construct(){
parent::__construct();
$this->_model=new MannagerModel();
}
/**
* 管理员添加
*/
public function addC(){
if(IS_POST){
$data=I('post.');
$res=$this->_model->Store($data);
$this->redirectUrl($res,'listC');
}
$this->display();
}
/**
* 管理员列表显示
* @return [type] [description]
*/
public function listC(){
$data=$this->_model->lists();
$this->assign('lists',$data);
$this->display();
}
/**
* 管理员删除
* @return [type] [description]
*/
public function delC(){
$id=intval(I('get.id'));
$res=$this->_model->del($id);
//跳转判断函数
$this->redirectUrl($res);
}
/**
* 管理员更新
* @return [type] [description]
*/
public function editC(){
$id=intval(I('get.id'));
//where的数组形式
$where['id']=$id;
// 显示旧数据
$old=$this->_model->lists($where);
$this->assign('old',$old);
//存储新的数据
if(IS_POST){
$data=I('post.');
$res=$this->_model->edit($id,$data);
$this->redirectUrl($res,'listC');
}
$this->display();
}