当前位置: 首页>>代码示例>>PHP>>正文


PHP Validate::getPost方法代码示例

本文整理汇总了PHP中Validate::getPost方法的典型用法代码示例。如果您正苦于以下问题:PHP Validate::getPost方法的具体用法?PHP Validate::getPost怎么用?PHP Validate::getPost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Validate的用法示例。


在下文中一共展示了Validate::getPost方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: newAction

 /**
  * 新增属性
  */
 public function newAction()
 {
     //检查是否是ajax请求
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['att_img'] = $validate->getPost('att_img', \Validate::base64());
         //属性图
         $data['att_name'] = $validate->getPost('att_name', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{2,30}$/iu'));
         //属性名称
         $data['att_sort'] = $validate->getPost('att_sort', \Validate::int());
         //排序
         //验证数据
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //生成学校logo,缩略图
         $data['att_img'] = \Func::touchImg($data['att_img'], 'att_img');
         //将生成的图片地址存入img,用户失败时删除
         $img = [UPLOAD_PATH . $data['att_img'], UPLOAD_PATH . $data['att_img']];
         //监测图片是否全部生成成功
         if (!$data['att_img']) {
             \FileUtil::getInstance()->unlink($img);
         }
         //新增高校
         $result = (new \Attribute())->addAttribute($this->session->get('id'), $data);
         if ($result != 200) {
             \FileUtil::getInstance()->unlink($img);
         }
         $this->end($result);
     }
     //加载所需js
     $this->assets->addJs('backend/mt-js/attribute-new.js');
 }
开发者ID:xw716825,项目名称:git_back,代码行数:36,代码来源:AttributeController.php

示例2: basicAction

 /**
  * 合作机构基本信息
  */
 public function basicAction($uni_id)
 {
     //判断是否是ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['union_logo'] = $validate->getPost('union_logo');
         //机构logo
         $data['union_name'] = $validate->getPost('union_name', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{2,30}$/iu'));
         //机构名称
         //验证参数
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //生成机构logo,缩略图
         if ($data['union_logo']) {
             $data['union_logo'] = \Func::touchImg($data['union_logo'], 'union_logo');
             //监测图片是否生成成功
             if (!$data['union_logo']) {
                 \FileUtil::getInstance()->unlink(UPLOAD_PATH . $data['union_logo']);
                 $this->end(400);
             }
         }
         $this->end((new \Union())->updUnionBasic($this->session->get('id'), $uni_id, $data));
     }
     //机构id
     $uni_id = (int) $uni_id;
     //获取基本数据
     $basic = (new \Union())->getUnionBasic($uni_id);
     //加载js
     $this->assets->addJs('backend/mt-js/union.js');
     $this->view->setVars(['uni_id' => $uni_id, 'basic' => $basic]);
 }
开发者ID:xw716825,项目名称:git_back,代码行数:35,代码来源:UnionController.php

示例3: detailAction

 /**
  * 修改新闻推荐
  */
 public function detailAction($news_com_id)
 {
     //判定是否是ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['news_com_id'] = $validate->getPost('news_com_id', \Validate::int());
         //新闻推荐id
         $data['news_id'] = $validate->getPost('news_id', \Validate::int());
         //新闻id
         $data['news_com_sort'] = $validate->getPost('news_com_sort', \Validate::regex('/^(0|[1-9]\\d{0,7})$/'));
         //新闻推荐排序
         $data['news_com_status'] = $validate->getPost('news_com_status', \Validate::scopeCall('Setting', 'getStatus'));
         //显示状态
         //验证参数
         if ($validate->getMessage()) {
             $this->end(400);
         }
         $this->end((new \NewsCommand())->updNewsCommand($this->session->get('id'), $data));
     }
     //新闻推荐id
     $news_com_id = (int) $news_com_id;
     //获取新闻推荐详情
     $detail = (new \NewsCommand())->getDetail($news_com_id);
     if ($detail == 404) {
         $this->notFound();
     }
     $this->view->setVars(['detail' => $detail]);
 }
开发者ID:xw716825,项目名称:git_back,代码行数:31,代码来源:NewscomController.php

示例4: detailAction

 /**
  * 高校教师的详细信息
  */
 public function detailAction($col_news_id)
 {
     //判断是否ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['col_id'] = $validate->getPost('col_id', \Validate::int());
         //学校id
         $data['col_news_thumb'] = $validate->getPost('col_news_thumb');
         //教师头像
         $data['col_news_id'] = $validate->getPost('col_news_id', \Validate::int());
         //动态id
         $data['col_news_title'] = $validate->getPost('col_news_title', \Validate::length(30, 2));
         //教师名称
         $data['col_news_content'] = $validate->getPost('col_news_content', \Validate::length(100000, 0));
         //教师简介
         //验证参数
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //生成教师头像
         if ($data['col_news_thumb']) {
             $data['col_news_thumb'] = \Func::touchImg($data['col_news_thumb'], 'col_news_thumb');
             if (!$data['col_news_thumb']) {
                 $this->end(400);
             }
         }
         $this->end((new \CollegeNews())->updNews($this->session->get('id'), $data));
     }
     //教师id
     $col_news_id = (int) $col_news_id;
     //教师数据
     $detail = (new \CollegeNews())->getNewsDetail($col_news_id);
     $this->view->setVars(['col_news_id' => $col_news_id, 'detail' => $detail, 'col_id' => $detail['col_id']]);
 }
开发者ID:xw716825,项目名称:git_back,代码行数:37,代码来源:ColnewsController.php

示例5: detailAction

 /**
  * 修改小初高动态
  */
 public function detailAction($sch_dny_id)
 {
     //判断是否ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['sch_id'] = $validate->getPost('sch_id', ['int']);
         //学校id
         $data['sch_dny_id'] = $validate->getPost('sch_dny_id', ['int']);
         //动态id
         $data['sch_dny_title'] = $validate->getPost('sch_dny_title', \Validate::length(60, 1), ['slashes' => true, 'html' => true]);
         //动态标题
         $data['sch_dny_content'] = $validate->getPost('sch_dny_content', \Validate::nil(), ['slashes' => true]);
         //动态内容
         //验证参数
         if ($validate->getMessage()) {
             $this->end(400);
         }
         $this->end((new \Dynamic())->updDynamic($this->session->get('id'), $data));
     }
     //动态id
     $sch_dny_id = (int) $sch_dny_id;
     //小初高学校动态数据
     $dynamic = (new \Dynamic())->getDynamicDetail($sch_dny_id);
     //获取学校类型
     $sch_dny_type = (new \Dynamic())->getDnyType($sch_dny_id);
     if ($sch_dny_type['sch_type'] == 1) {
         $this->view->setLayout("kindergarten");
     } else {
         $this->view->setLayout("school");
     }
     $this->view->setVars(['sch_dny_id' => $sch_dny_id, 'dynamic' => $dynamic, 'sch_id' => $dynamic['sch_id'], 'sch_dny_type' => $sch_dny_type]);
 }
开发者ID:xw716825,项目名称:git_back,代码行数:35,代码来源:DynamicController.php

示例6: detailAction

 /**
  * 修改专题分类
  */
 public function detailAction($art_ban_id)
 {
     //判断是否是ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['top_cat_id'] = $validate->getPost('top_cat_id', ['int']);
         //专题id
         $data['top_cat_name'] = $validate->getPost('top_cat_name', ['length' => ['max' => 30, 'min' => 0]], ['slashes' => true, 'html' => true]);
         //专题分类名称
         //验证参数
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //修改专题
         $result = (new \TopicCategory())->updTopicCategory($this->session->get('id'), $data);
         $this->end($result);
     }
     //数据id
     $art_ban_id = (int) $art_ban_id;
     //专题分类详情
     $basic = (new \Topic())->getDetail($art_ban_id);
     //加载js
     $this->assets->addJs('backend/mt-js/topiccat.js');
     $this->view->setVars(['basic' => $basic]);
 }
开发者ID:xw716825,项目名称:git_back,代码行数:28,代码来源:TopiccatController.php

示例7: newAction

 public function newAction()
 {
     //判定是否是ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['que_id'] = $validate->getPost('que_id', \Validate::int());
         //新闻id
         $data['que_content'] = $validate->getPost('que_content', \Validate::nil(), ['slashes' => true]);
         //测试题内容
         //验证参数
         if ($validate->getMessage()) {
             $this->end(400);
         }
         $this->end((new \Questions())->addQuestions($this->session->get('id'), $data));
     }
 }
开发者ID:xw716825,项目名称:git_back,代码行数:16,代码来源:QuestionsController.php

示例8: listAction

 /**
  * 新闻Banner列表
  */
 public function listAction()
 {
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $id = (int) $validate->getPost('id');
         if (!$id) {
             $this->end(400);
         }
         $this->end((new \SingleReward())->UpdateHandle($id));
     }
     //当前页码
     $page_id = (int) $this->request->getQuery('page');
     $page_id = $page_id < 1 ? 1 : $page_id;
     //每页显示条数
     $limit = 20;
     //显示状态
     $status = $this->request->getQuery('status');
     //关键字
     $keyword = preg_replace('/[^\\da-z\\x{4e00}-\\x{9fa5}]/iu', '', mb_substr($this->request->getQuery('keyword'), 0, 10, 'utf-8'));
     //关键字长度小于10,并且只能是字符数字中文
     //所有显示状态
     $statuses = \Setting::getStatus();
     $statuses = ['' => '所有状态'] + $statuses;
     //列表查询
     $list = (new \SingleReward())->getList($page_id, $limit, $status, $keyword);
     $page_html = $this->pageHtml($list['page']);
     //加载js
     $this->assets->addJs('backend/mt-js/single-reward.js');
     $this->view->setVars(['status' => $status, 'keyword' => $keyword, 'statuses' => $statuses, 'list' => $list['list'], 'page_html' => $page_html]);
 }
开发者ID:xw716825,项目名称:git_back,代码行数:33,代码来源:SinglerewController.php

示例9: detailAction

 /**
  * 高校教师的详细信息
  */
 public function detailAction($tra_tea_id)
 {
     //判断是否ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['tra_id'] = $validate->getPost('tra_id', \Validate::int());
         //学校id
         $data['tea_id'] = $validate->getPost('tea_id', \Validate::int());
         //教师id
         $data['is_hot'] = $validate->getPost('is_hot', \Validate::int());
         //热门
         $data['tea_name'] = $validate->getPost('tea_name', \Validate::length(15, 2));
         //教师名称
         $data['tea_specialty'] = $validate->getPost('tea_specialty', \Validate::length(10, 2));
         //教师学位
         $data['tea_position'] = $validate->getPost('tea_position', \Validate::length(20, 2));
         //教师职位
         $data['tea_college'] = $validate->getPost('tea_college', \Validate::length(30, 2));
         //毕业学校
         $data['tea_sort'] = $validate->getPost('tea_sort', \Validate::length(99999999, 0));
         //排序
         $data['tea_summary'] = $validate->getPost('tea_summary', \Validate::length(255, 2));
         //教师简介
         $data['tea_head'] = $validate->getPost('tea_head');
         //教师头像
         //验证参数
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //生成教师头像
         if ($data['tea_head']) {
             $data['tea_head'] = \Func::touchImg($data['tea_head'], 'tea_head');
             if (!$data['tea_head']) {
                 $this->end(400);
             }
         }
         $this->end((new \TrainTeacher())->updTeacher($this->session->get('id'), $data));
     }
     //教师id
     $tra_tea_id = (int) $tra_tea_id;
     //教师数据
     $teacher = (new \TrainTeacher())->getTeacherDetail($tra_tea_id);
     $this->view->setVars(['tra_tea_id' => $tra_tea_id, 'teacher' => $teacher, 'tra_id' => $teacher['tra_id']]);
 }
开发者ID:xw716825,项目名称:git_back,代码行数:47,代码来源:TrateacherController.php

示例10: tralistAction

 public function tralistAction($tra_id)
 {
     //判断是否是ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $tra_scene = $validate->getPost('scene', \Validate::arr());
         $tra_id = (int) $tra_id;
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //新增的图片
         $new_img = [];
         //处理图片
         foreach ($tra_scene as $key => $val) {
             //检查字段是否设置
             if (!isset($val['img']) || !isset($val['content']) || !isset($val['sort'])) {
                 \FileUtil::getInstance()->unlink($new_img);
                 $this->end(400);
             }
             //清除错误信息
             $validate->clearMessage();
             //验证字段
             $tra_scene[$key]['sort'] = (int) $val['sort'];
             //图片排序
             $tra_scene[$key]['content'] = $validate->execute($val['content'], \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{1,30}$/iu'));
             //图片介绍
             if ($validate->getMessage()) {
                 \FileUtil::getInstance()->unlink($new_img);
                 $this->end(400);
             }
             //创建学校风光图,并验证是否创建成功
             $tra_scene[$key]['img'] = \Func::touchImg($val['img'], 'tra_scene');
             if (!$val['img']) {
                 \FileUtil::getInstance()->unlink($new_img);
                 $this->end(400);
             }
             //将生成成功的图片存入数组
             $new_img[] = UPLOAD_PATH . $tra_scene[$key]['img'];
         }
         //修改风光图
         $result = (new \Scene())->updTrainScene($this->session->get('id'), $tra_id, $tra_scene);
         //未修改成功,则删除新增的图片
         if ($result != 200) {
             \FileUtil::getInstance()->unlink($new_img);
         }
         $this->end($result);
     }
     //学校id
     $tra_id = (int) $tra_id;
     //获取学校风光图
     $scene = (new \Scene())->getTrainScene($tra_id);
     //加载js
     $this->assets->addJs('backend/mt-js/scene-tralist.js');
     $this->view->setLayout("train");
     $this->view->setVars(['tra_id' => $tra_id, 'scene' => $scene]);
 }
开发者ID:xw716825,项目名称:git_back,代码行数:56,代码来源:SceneController.php

示例11: newAction

 /**
  * 新增隶属部门
  */
 public function newAction()
 {
     //判断是否ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['dep_name'] = $validate->getPost('dep_name', \Validate::length(15, 2));
         //入学途径名称
         $data['dep_sort'] = $validate->getPost('dep_sort', \Validate::int());
         //入学途径排序
         //验证参数
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //新增动态
         $this->end((new \Department())->addDepartment($this->session->get('id'), $data));
     }
     //加载js
     $this->assets->addJs('backend/mt-js/school-department.js');
 }
开发者ID:xw716825,项目名称:git_back,代码行数:22,代码来源:DepartmentController.php

示例12: detailAction

 /**
  * 修改banner新闻
  */
 public function detailAction($news_com_id)
 {
     //判定是否是ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['news_ban_id'] = $validate->getPost('news_ban_id', \Validate::int());
         //banner新闻id
         $data['news_id'] = $validate->getPost('news_id', \Validate::int());
         //新闻id
         $data['news_ban_img'] = $validate->getPost('news_ban_img');
         //banner图片
         $data['news_ban_alt'] = $validate->getPost('news_ban_alt', \Validate::regex('/^[\\da-z\\x{4e00}-\\x{9fa5}]{1,30}$/iu'));
         //banner图片介绍
         $data['news_ban_sort'] = $validate->getPost('news_ban_sort', \Validate::regex('/^(0|[1-9]\\d{0,7})$/'));
         //banner新闻排序
         $data['news_ban_status'] = $validate->getPost('news_ban_status', \Validate::scopeCall('Setting', 'getStatus'));
         //显示状态
         //验证参数
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //创建banner图片
         $img = $data['news_ban_img'];
         $data['news_ban_img'] = \Func::touchImg($img, 'news_ban');
         if ($img && !$data['news_ban_img']) {
             $this->end(400);
         }
         $result = (new \NewsBanner())->updNewsBanner($this->session->get('id'), $data);
         if ($result != 200 && is_file(UPLOAD_PATH . $img)) {
             unlink(UPLOAD_PATH . $img);
         }
         $this->end($result);
     }
     //新闻推荐id
     $news_com_id = (int) $news_com_id;
     //获取新闻推荐详情
     $detail = (new \NewsBanner())->getDetail($news_com_id);
     if ($detail == 404) {
         $this->notFound();
     }
     $this->view->setVars(['detail' => $detail]);
 }
开发者ID:xw716825,项目名称:git_back,代码行数:45,代码来源:NewsbanController.php

示例13: newAction

 /**
  * 新增属性
  */
 public function newAction()
 {
     //检查是否是ajax请求
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['att_name'] = $validate->getPost('att_name', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{2,30}$/iu'));
         //属性名称
         $data['att_sort'] = $validate->getPost('att_sort', \Validate::int());
         //排序
         //验证数据
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //新增高校
         $result = (new \MajorKeywords())->addKeywords($this->session->get('id'), $data);
         $this->end($result);
     }
     //加载所需js
     $this->assets->addJs('backend/mt-js/keywords.js');
 }
开发者ID:xw716825,项目名称:git_back,代码行数:23,代码来源:MajorkeyController.php

示例14: detailAction

 /**
  * 修改友情链接
  */
 public function detailAction($link_id)
 {
     //判断是否是ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['link_id'] = $validate->getPost('link_id', \Validate::int());
         //数据id
         $data['link_name'] = $validate->getPost('link_name', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{1,30}$/iu'));
         //友情链接名称
         $data['link_url'] = $validate->getPost('link_url', \Validate::regex('/^(http(s)?:\\/\\/)/'), ['slashes' => true, 'html' => true]);
         //链接url
         $data['link_sort'] = $validate->getPost('link_sort', \Validate::between(99999999, 0));
         //友情链接排序
         $data['link_logo'] = $validate->getPost('link_logo');
         //友情链接logo
         //验证参数
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //生成友情链接logo
         if ($data['link_logo']) {
             $data['link_logo'] = \Func::touchImg($data['link_logo'], 'link_logo');
             if (!$data['link_logo']) {
                 $this->end(400);
             }
         }
         //修改友情链接
         $result = (new \Link())->updLink($this->session->get('id'), $data);
         if ($result != 200) {
             \FileUtil::getInstance()->unlink(UPLOAD_PATH . $data['link_logo']);
         }
         $this->end($result);
     }
     //数据id
     $link_id = (int) $link_id;
     //热点文章详情数据
     $basic = (new \Link())->getLinkDetail($link_id);
     //加载js
     $this->assets->addJs('backend/mt-js/link.js');
     $this->view->setVars(['basic' => $basic]);
 }
开发者ID:xw716825,项目名称:git_back,代码行数:44,代码来源:LinkController.php

示例15: detailAction

 /**
  * 修改考试日历
  */
 public function detailAction($cal_id)
 {
     //判断是否是ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['cal_id'] = $validate->getPost('cal_id', \Validate::int());
         //考试日历id
         $data['cal_year'] = $validate->getPost('cal_year', \Validate::scope(range(2014, 2020)));
         //考试年份
         $data['cal_month'] = $validate->getPost('cal_month', \Validate::scope(range(1, 12)));
         //考试月份
         $data['cal_date'] = $validate->getPost('cal_date', \Validate::length(30, 1), ['slashes' => true, 'html' => true]);
         //具体考试时间
         $data['cal_name'] = $validate->getPost('cal_name', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{2,30}$/iu'));
         //考试名称
         $data['cal_sort'] = $validate->getPost('cal_sort', \Validate::between(99999999, 0));
         //分类介绍
         //验证参数
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //修改banner
         $result = (new \Calendar())->updCalendar($this->session->get('id'), $data);
         $this->end($result);
     }
     //数据id
     $cal_id = (int) $cal_id;
     //考试日历详情数据
     $basic = (new \Calendar())->getCalenderDetail($cal_id);
     //加载js
     $this->assets->addJs('backend/mt-js/calendar.js');
     $this->view->setVars(['basic' => $basic]);
 }
开发者ID:xw716825,项目名称:git_back,代码行数:36,代码来源:CalendarController.php


注:本文中的Validate::getPost方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。