public function test() { // $this->show('<html><form action="'.U('Publish/upload').'" method="post" enctype="multipart/form-data"><input name="a" type="file"><input type="submit" value="上传"></form>','utf-8'); var_dump(I('session.')); if (checkSuperUser()) { echo 'true'; } else { echo 'false'; } }
/** * 搜索用户 */ public function searchUser() { $type = I('post.type', 'name'); $search_content = I('post.search', ''); if (empty($search_content)) { $this->ajaxReturn("请输入内容!"); return; } $type_array = array('name', 'stuid', 'phone', 'identity'); if (!in_array($type, $type_array)) { $type = 'name'; } $user = M('user_member'); switch ($type) { case 'name': $type = 'real_name'; break; case 'stuid': $type = 'stu_num'; break; case 'phone': $type = 'phone'; break; case 'identity': $type = 'stu_idcard'; break; default: $type = 'name'; break; } $condition = array($type => array('like', '%' . $search_content . '%')); $result = $user->where($condition)->select(); $filter = array(); $resultFiltered = array(); if (checkSuperUser()) { $filter = array('real_name', 'gender', 'email', 'stu_num', 'stu_idcard', 'phone'); //phone 字段数据库没有,待添加。 } else { $filter = array('real_name', 'gender', 'email', 'stu_num'); } foreach ($result as $key => $value) { $resultFiltered[$key] = $this->arrayFilter($value, $filter, false); } $this->ajaxReturn($resultFiltered); }