當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Validate::getMessage方法代碼示例

本文整理匯總了PHP中Validate::getMessage方法的典型用法代碼示例。如果您正苦於以下問題:PHP Validate::getMessage方法的具體用法?PHP Validate::getMessage怎麽用?PHP Validate::getMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Validate的用法示例。


在下文中一共展示了Validate::getMessage方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例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: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: formAction

 /**
  * 新增專題
  */
 public function formAction()
 {
     //定義js匿名函數
     $execJs = function ($msg) {
         $js = "<script type='text/javascript'>\r\n                        //禁止回退\r\n                        window.history.forward(1);\r\n                            alert('{$msg}');\r\n                        location.href = history.go(-1);\r\n                    </script>";
         die($js);
     };
     $validate = new \Validate();
     $data['file_cat_id'] = $validate->getPost('file_cat_id', \Validate::int());
     //專題類型
     //驗證參數
     if ($validate->getMessage()) {
         $execJs('參數錯誤');
     }
     //驗證文件
     if (!isset($_FILES['doc'])) {
         $execJs('非法操作');
     }
     //驗證zip壓縮文件
     $doc = new File($_FILES['doc']);
     if ($doc->getExtension() != 'doc' && $doc->getExtension() != 'docx' && $doc->getExtension() != 'ppt' && $doc->getExtension() != 'pptx') {
         $execJs('請上傳doc、docx、ppt、pptx類型的文件');
     }
     $file_name = $doc->getName();
     //創建目錄
     $file_path = FILE_PATH . '/file/' . $data['file_cat_id'];
     $util = new \FileUtil();
     $util->mkdir($file_path);
     $data['file_url'] = '/file/' . $data['file_cat_id'] . '/' . md5($file_name . time()) . '.' . $doc->getExtension();
     $file_url = FILE_PATH . $data['file_url'];
     $data['file_name'] = $file_name;
     //移動資源文件,並重命名,與phtml文件相同
     $doc->moveTo($file_url);
     $result = (new \File())->addFile($this->session->get('id'), $data);
     if ($result != 200) {
         //刪除所有專題相關文件
         $this->unlink($file_url);
         $execJs('上傳失敗');
     }
     $execJs('專題添加成功');
 }
開發者ID:xw716825,項目名稱:git_back,代碼行數:44,代碼來源:FileController.php

示例13: detailAction

 public function detailAction($id)
 {
     //判定是否是ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['maj_id'] = $validate->getPost('maj_id', \Validate::int());
         //專業ID
         $data['maj_kidney'] = $validate->getPost('maj_kidney', \Validate::int());
         //性格專業
         //驗證參數
         if ($validate->getMessage()) {
             $this->end(400);
         }
         $this->end((new \QuestionsMajor())->updateMajor($this->session->get('id'), $data));
     }
     $id = (int) $id;
     $detail = (new \QuestionsMajor())->getDetail($id);
     if (empty($detail)) {
         $this->notFound();
     }
     $this->view->setVars(['detail' => $detail]);
 }
開發者ID:xw716825,項目名稱:git_back,代碼行數:22,代碼來源:QuestionsmajController.php

示例14: updpwdAction

 /**
  * 修改管理員密碼
  */
 public function updpwdAction()
 {
     //判斷是否是ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $old_pwd = $validate->getPost('old_pwd', \Validate::length(30, 6));
         //舊密碼
         $new_pwd = $validate->getPost('new_pwd', \Validate::length(30, 6));
         //舊密碼
         //驗證參數
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //加密
         $old_pwd = $this->password($old_pwd);
         $new_pwd = $this->password($new_pwd);
         //修改密碼
         $this->end((new \Manager())->updPassword($this->session->get('id'), $old_pwd, $new_pwd));
     }
     //加載js
     $this->assets->addJs('backend/mt-js/pwd.js');
 }
開發者ID:xw716825,項目名稱:git_back,代碼行數:25,代碼來源:HomeController.php

示例15: wapAction

 public function wapAction()
 {
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['name'] = $validate->getPost('name', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{1,30}$/iu'));
         $data['phone'] = $validate->getPost('phone', \Validate::regex('/^1[358]\\d{9}$/iu'));
         $data['record'] = $validate->getPost('record', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{1,30}$/iu'));
         $data['hope'] = $validate->getPost('hope', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{1,30}$/iu'));
         $data['review'] = '';
         if ($validate->getMessage()) {
             $this->end(400);
         }
         $this->end((new \Single())->addRegister($data));
     }
     $get_url = 'http://' . $this->request->getHttpHost() . $this->request->getURI();
     $share_url = 'http://www.51sxwang.com/single/wap';
     if ($get_url != $share_url) {
         $this->response->redirect($share_url);
     }
     $this->view->setLayout('');
     $data = $this->getSignature($share_url);
     $this->view->setVar('wx_config', $data);
 }
開發者ID:xw716825,項目名稱:git_back,代碼行數:23,代碼來源:SingleController.php


注:本文中的Validate::getMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。