當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。