public function add() { if (isset($_SESSION['name']) && $_SESSION['role'] == 1) { $Manager = new \Model\ManagerModel(); if (!empty($_POST)) { $z = $Manager->create(); if (!$z) { $this->error($Manager->getError() . '!', 'javascript:history.back();'); } else { $z = $Manager->add(); if ($z) { $this->success("添加管理员成功!", U('index')); } else { $this->error("添加管理员失败!", U('index')); } } } else { $this->assign('id', $_SESSION['id']); $this->assign('name', $_SESSION['name']); $this->assign('role', $_SESSION['role']); $front = D("Front"); $fid = 1; $resultByFront = $front->where('fid = ' . $fid)->find(); $this->assign('resultByFront', $resultByFront); $this->display(); } } else { $this->error("非法访问,你不是超级管理员!", U('Index/index')); } }