public function updateImg() { $id = I('post.id'); // 获取原有图片 $img = I('post.img'); // 判断 $_FILES if (!empty($_FILES)) { $upload = new ImageUploadController(); $image = $upload->imageUploadOne($_FILES); } else { $image = ''; } $data = array('id' => $id, 'image' => $image); $res = D('Auth')->save($data); if ($res) { // 回收原有图片 $recycle = new ImageUploadController(); $recycle->recycle($img); } $mess = new MessController(); $mess->message($res, '修改成功', '修改失败', U('Auth/index', array('mess' => '修改成功'))); }
public function delete() { $id = I('get.id'); $img = D('Auth')->where(array('id' => $id))->getField('image'); $res = D('BusinessLogic')->delete($id); if ($res) { $recycle = new ImageUploadController(); $recycle->recycle($img); } $mess = new MessController(); $mess->message($res, '删除成功', '删除失败', U('BusinessLogic/index', array('mess' => '删除成功'))); }