function add() { if (!empty($_POST)) { //通过数据模型 将提交的数据整合以便将所有字段插入数据表中 $auth_M = new \Model\AuthModel(); $t = $auth_M->auth_save($_POST); if ($t) { $this->success('添加成功', U('showlist')); } else { $this->success('添加失败,请重试', U('showlist')); } } else { $info = $this->getInfo(); $authinfo = array(); foreach ($info as $k => $v) { $authinfo[$v['auth_id']] = $v['auth_name']; } $this->assign('authinfo', $authinfo); $this->display(); } }