🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
## 代码 ``` <?php namespace app\agent\controller; use think\Controller; use think\Db; class UserController extends Controller { /** * 管理员删除 */ public function delete() { $id = $this->request->param('id', 0, 'intval'); if ($id == 1) { $this->error("最高管理员不能删除!"); } if (Db::name('user')->delete($id) !== false) { Db::name("RoleUser")->where(["user_id" => $id])->delete(); $this->success("删除成功!"); } else { $this->error("删除失败!"); } } } ```