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


PHP Validate::base64方法代碼示例

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


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

示例1: newAction

 /**
  * 新增合作機構
  */
 public function newAction()
 {
     //檢查是否是ajax請求
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['union_logo'] = $validate->getPost('union_logo', \Validate::base64());
         //機構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,縮略圖
         $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);
         }
         //新增機構
         $result = (new \Union())->addUnion($this->session->get('id'), $data);
         if ($result != 200) {
             \FileUtil::getInstance()->unlink(UPLOAD_PATH . $data['union_logo']);
         }
         $this->end($result);
     }
     //加載js
     $this->assets->addJs('backend/mt-js/union.js');
     $this->view->setVars([]);
 }
開發者ID:xw716825,項目名稱:git_back,代碼行數:34,代碼來源:UnionController.php

示例2: newAction

 /**
  * 新增校友
  */
 public function newAction($col_id)
 {
     //判斷是否ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['col_id'] = $validate->getPost('col_id', \Validate::int());
         //學校id
         $data['alu_head'] = $validate->getPost('alu_head', \Validate::base64());
         //校友頭像
         $data['alu_name'] = $validate->getPost('alu_name', \Validate::length(15, 2));
         //校友名稱
         $data['alu_desc'] = $validate->getPost('alu_desc', \Validate::length(255, 2));
         //校友簡介
         $data['alu_src'] = $validate->getPost('alu_src', \Validate::length(255, 2));
         //資料來源
         //驗證參數
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //生成校友頭像
         $data['alu_head'] = \Func::touchImg($data['alu_head'], 'alu_head');
         //監測圖片是否生成成功
         if (!$data['alu_head']) {
             \FileUtil::getInstance()->unlink(UPLOAD_PATH . $data['alu_head']);
             $this->end(400);
         }
         //新增動態
         $this->end((new \CollegeAlumnus())->addAlumnus($this->session->get('id'), $data));
     }
     $this->view->setVars(['col_id' => $col_id]);
 }
開發者ID:xw716825,項目名稱:git_back,代碼行數:34,代碼來源:ColalumnusController.php

示例3: newAction

 /**
  * 新增banner新聞
  */
 public function newAction()
 {
     //判定是否是ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['news_id'] = $validate->getPost('news_id', \Validate::int());
         //新聞id
         $data['news_ban_img'] = $validate->getPost('news_ban_img', \Validate::base64());
         //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圖片
         $data['news_ban_img'] = \Func::touchImg($data['news_ban_img'], 'news_ban');
         if (!$data['news_ban_img']) {
             $this->end(400);
         }
         $result = (new \NewsBanner())->addNewsBanner($this->session->get('id'), $data);
         if ($result != 200) {
             unlink(UPLOAD_PATH . $data['news_ban_img']);
         }
         $this->end($result);
     }
 }
開發者ID:xw716825,項目名稱:git_back,代碼行數:34,代碼來源:NewsbanController.php

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

示例5: newAction

 /**
  * 新增小初高教師
  */
 public function newAction($sch_id)
 {
     //判斷是否ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['sch_id'] = $validate->getPost('sch_id', \Validate::int());
         //學校id
         $data['tea_head'] = $validate->getPost('tea_head', \Validate::base64());
         //教師頭像
         $data['tea_name'] = $validate->getPost('tea_name', \Validate::length(15, 2));
         //教師名稱
         $data['tea_degree'] = $validate->getPost('tea_degree', \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));
         //教師簡介
         // print_r($data);
         //驗證參數
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //生成教師頭像
         $data['tea_head'] = \Func::touchImg($data['tea_head'], 'tea_head');
         //監測圖片是否生成成功
         if (!$data['tea_head']) {
             \FileUtil::getInstance()->unlink(UPLOAD_PATH . $data['tea_head']);
             $this->end(400);
         }
         //新增動態
         $this->end((new \Teacher())->addTeacher($this->session->get('id'), $data));
     }
     //獲取學校類型
     $sch_type = (new \School())->getSchoolBasic($sch_id);
     if ($sch_type['sch_type'] == 1) {
         $this->view->setLayout("kindergarten");
     } else {
         $this->view->setLayout("school");
     }
     $this->view->setVars(['sch_id' => $sch_id]);
     $this->view->setVars(['sch_id' => $sch_id, 'sch_type' => $sch_type]);
 }
開發者ID:xw716825,項目名稱:git_back,代碼行數:49,代碼來源:TeacherController.php

示例6: newAction

 /**
  * 新增新聞
  */
 public function newAction()
 {
     //判定是否ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['news_title'] = $validate->getPost('news_title', \Validate::length(50, 1), ['slashes' => true]);
         //新聞標題
         $data['news_cat_id'] = $validate->getPost('news_cat_id', \Validate::int());
         //新聞分類
         $data['news_thumb'] = $validate->getPost('news_thumb', \Validate::base64());
         //新聞縮略圖
         $data['news_source'] = $validate->getPost('news_source', \Validate::regex('/^[a-z\\d\\x{4e00}-\\x{9fa5}]{0,10}$/iu'));
         //新聞來源
         $data['news_content'] = $validate->getPost('news_content', \Validate::nil(), ['slashes' => true]);
         //新聞標題
         $data['news_key'] = $validate->getPost('news_key', \Validate::length(30, 0), ['slashes' => true, 'html' => true]);
         //關鍵詞
         $data['news_desc'] = $validate->getPost('news_desc', \Validate::length(250, 0), ['slashes' => true, 'html' => true]);
         //描述
         //驗證參數
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //生成縮略圖
         $data['news_thumb'] = \Func::touchImg($data['news_thumb'], 'news_thumb');
         if (!$data['news_thumb']) {
             $this->end(400);
         }
         $result = (new \News())->addNews($this->session->get('id'), $data);
         if ($result != 200) {
             //刪除生成的圖片
             unlink(UPLOAD_PATH . $data['news_thumb']);
         }
         $this->end($result);
     }
     //新聞分類
     $categories = (new \News())->getCategorylist();
     //加載js
     $this->assets->addJs('backend/js/editors/summernote/summernote.js');
     $this->view->setVars(['categories' => $categories]);
 }
開發者ID:xw716825,項目名稱:git_back,代碼行數:44,代碼來源:NewsController.php

示例7: newAction

 /**
  * 新增高校教師
  */
 public function newAction($tra_id)
 {
     //判斷是否ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['tra_id'] = $validate->getPost('tra_id', \Validate::int());
         //學校id
         $data['is_hot'] = $validate->getPost('is_hot', \Validate::int());
         //熱門
         $data['tea_head'] = $validate->getPost('tea_head', \Validate::base64());
         //教師頭像
         $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));
         //教師簡介
         //驗證參數
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //生成教師頭像
         $data['tea_head'] = \Func::touchImg($data['tea_head'], 'tea_head');
         //監測圖片是否生成成功
         if (!$data['tea_head']) {
             \FileUtil::getInstance()->unlink(UPLOAD_PATH . $data['tea_head']);
             $this->end(400);
         }
         //新增動態
         $this->end((new \TrainTeacher())->addTeacher($this->session->get('id'), $data));
     }
     $this->view->setVars(['tra_id' => $tra_id]);
 }
開發者ID:xw716825,項目名稱:git_back,代碼行數:42,代碼來源:TrateacherController.php

示例8: newAction

 /**
  * 新增學校
  */
 public function newAction()
 {
     //檢查是否是ajax請求
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['col_logo'] = $validate->getPost('col_logo', \Validate::base64());
         //學校logo
         $data['col_thumb'] = $validate->getPost('col_thumb', \Validate::base64());
         //學校縮略圖
         $data['col_name'] = $validate->getPost('col_name', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}\\(\\)()]{2,30}$/iu'));
         //學校名稱
         $data['col_code'] = $validate->getPost('col_code', \Validate::regex('/^(\\d{3,6})?$/'));
         //學校code
         $data['col_build'] = $validate->getPost('col_build', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}\\(\\)\\-()]{0,30}$/iu'));
         //學校創建時間
         $data['att_id'] = $validate->getPost('att_id');
         //學校屬性
         $data['col_department'] = $validate->getPost('col_department', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{2,30}$/iu'));
         //隸屬部門
         $data['gen_id'] = $validate->getPost('gen_id', \Validate::int());
         //教學類型
         $data['is_join'] = $validate->getPost('is_join', \Validate::scopeCall('Setting', 'getJoin'));
         //官方合作
         $data['is_fine'] = $validate->getPost('is_fine', \Validate::scopeCall('Setting', 'getFine'));
         //官方合作
         $data['is_honesty'] = $validate->getPost('is_honesty', \Validate::scopeCall('Setting', 'getFine'));
         //官方合作
         $data['public_type'] = $validate->getPost('public_type', \Validate::scopeCall('Setting', 'getPublic'));
         //辦學性質
         $data['hire_type'] = $validate->getPost('hire_type', \Validate::scopeCall('Setting', 'getHire'));
         //辦學性質
         $data['col_type'] = $validate->getPost('col_type', \Validate::scopeCall('Setting', 'getColType'));
         //學校類型
         $data['col_tel'] = $validate->getPost('col_tel', \Validate::length(60, 0), ['slashes' => true, 'html' => true]);
         //聯係電話
         $data['col_mail'] = $validate->getPost('col_mail', \Validate::length(80, 0), ['slashes' => true, 'html' => true]);
         //郵箱
         $data['col_url'] = $validate->getPost('col_url', \Validate::length(80, 0), ['slashes' => true, 'html' => true]);
         //學校官網
         $data['col_enroll_url'] = $validate->getPost('col_enroll_url', \Validate::length(80, 0), ['slashes' => true, 'html' => true]);
         //學校招生官網
         $data['col_man'] = $validate->getPost('col_man', \Validate::int());
         //男生比例
         $data['col_degree'] = $validate->getPost('col_degree', \Validate::int());
         //報考難度
         $data['col_job'] = $validate->getPost('col_job', \Validate::int());
         //報考難度
         $data['col_academician'] = $validate->getPost('col_academician', \Validate::int());
         //院士數量
         $data['col_test'] = $validate->getPost('col_test', \Validate::int());
         //國家實驗室數量
         $data['col_stress'] = $validate->getPost('col_stress', \Validate::int());
         //重點專業數量
         $data['col_master'] = $validate->getPost('col_master', \Validate::int());
         //碩士點數
         $data['col_doctor'] = $validate->getPost('col_doctor', \Validate::int());
         //院士點數
         $data['pro_code'] = $validate->getPost('pro_code', \Validate::regex('/^[1-9]\\d{5}$/'));
         //學校所在省份編碼
         $data['city_code'] = $validate->getPost('city_code', \Validate::regex('/^[1-9]\\d{5}$/'));
         //學校所在城市編碼
         $data['col_addr'] = $validate->getPost('col_addr', \Validate::length(60, 0), ['slashes' => true, 'html' => true]);
         //詳細地址
         $data['col_summary'] = $validate->getPost('col_summary', \Validate::length(10000, 0), ['slashes' => true]);
         //學校簡介
         $data['col_key'] = $validate->getPost('col_key', \Validate::length(100, 0), ['slashes' => true, 'html' => true]);
         //關鍵詞
         $data['col_desc'] = $validate->getPost('col_desc', \Validate::length(250, 0), ['slashes' => true, 'html' => true]);
         //描述
         $data['col_cost'] = $validate->getPost('col_cost', \Validate::length(10000, 0), ['slashes' => true]);
         //收費情況
         $data['col_general'] = $validate->getPost('col_general', \Validate::length(10000, 0), ['slashes' => true]);
         //招生簡章
         //驗證數據
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //生成學校logo,縮略圖
         $data['col_logo'] = \Func::touchImg($data['col_logo'], 'col_logo');
         $data['col_thumb'] = \Func::touchImg($data['col_thumb'], 'col_thumb');
         //將生成的圖片地址存入img,用戶失敗時刪除
         $img = [UPLOAD_PATH . $data['col_logo'], UPLOAD_PATH . $data['col_thumb']];
         //監測圖片是否全部生成成功
         if (!$data['col_logo'] || !$data['col_thumb']) {
             \FileUtil::getInstance()->unlink($img);
         }
         //新增高校
         $result = (new \College())->addCollege($this->session->get('id'), $data);
         if ($result != 200) {
             \FileUtil::getInstance()->unlink($img);
         }
         $this->end($result);
     }
     //加載所需js
     $this->assets->addJs('backend/js/datetime/bootstrap-datepicker.js');
     $this->assets->addJs('backend/js/editors/summernote/summernote.js');
     $this->assets->addJs('backend/mt-js/college-new.js');
//.........這裏部分代碼省略.........
開發者ID:xw716825,項目名稱:git_back,代碼行數:101,代碼來源:CollegeController.php

示例9: newAction

 /**
  * 新增學校課程
  */
 public function newAction($tra_id)
 {
     //檢查是否是ajax請求
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['tra_id'] = (int) $tra_id;
         //學校ID
         $data['cou_thumb'] = $validate->getPost('cou_thumb', \Validate::base64());
         //學校縮略圖
         $data['spe_id'] = $validate->getPost('spe_id', \Validate::int());
         //分類ID
         $data['cou_name'] = $validate->getPost('cou_name', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{2,30}$/iu'));
         //課程名稱
         $data['cou_sort'] = $validate->getPost('cou_sort', \Validate::int());
         //課程排序
         $data['cou_price'] = $validate->getPost('cou_price', \Validate::regex('/^[a-z0-9\\.\\/\\(\\)\\(\\)\\x{4e00}-\\x{9fa5}]{0,30}$/iu'));
         //課程價格
         $data['cou_system'] = $validate->getPost('cou_system', \Validate::int());
         //上課類型
         $data['is_hot'] = $validate->getPost('is_hot', \Validate::int());
         //是否熱門
         $data['cou_summary'] = $validate->getPost('cou_summary', \Validate::nil(), ['slashes' => true]);
         //課程簡介
         $data['cou_key'] = $validate->getPost('cou_key', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{1,10}([\\s,][a-z0-9\\x{4e00}-\\x{9fa5}]{1,10}){0,9}$/iu'));
         //關鍵詞
         $data['cou_desc'] = $validate->getPost('cou_desc', \Validate::length(250, 0), ['slashes' => true, 'html' => true]);
         //描述
         $data['cou_trait'] = $validate->getPost('cou_trait', \Validate::length(250, 0), ['slashes' => true, 'html' => true]);
         //優勢
         $data['tea_id'] = $validate->getPost('tea_id');
         $data['cou_addr'] = $validate->getPost('cou_addr');
         //驗證數據
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //驗證機構是否存在
         if (!(new \Train())->getDetail($tra_id)) {
             $this->end(404);
         }
         //生成課程縮略圖
         $data['cou_thumb'] = \Func::touchImg($data['cou_thumb'], 'cou_thumb');
         //將生成的圖片地址存入img,用戶失敗時刪除
         $img = [UPLOAD_PATH . $data['cou_thumb']];
         //監測圖片是否全部生成成功
         if (!$data['cou_thumb']) {
             \FileUtil::getInstance()->unlink($img);
         }
         //新增機構課程
         $result = (new \Course())->addCourse($this->session->get('id'), $data);
         if ($result != 200) {
             $this->end($result);
         }
         $this->end($result);
     }
     //獲取一級分類
     $cate1 = (new \Course())->getCategory();
     //獲取機構教師
     $teachers = (new \TrainTeacher())->getTeacherList($tra_id, 1, 999)['list'];
     //加載所需js
     $this->assets->addJs('backend/js/editors/summernote/summernote.js');
     $this->assets->addJs('backend/mt-js/bootstrap-tagsinput.js');
     $this->assets->addJs('backend/mt-js/course-new.js');
     $this->view->setLayout('train');
     $this->view->setVars(['tra_id' => $tra_id, 'cate1' => $cate1, 'teachers' => $teachers]);
 }
開發者ID:xw716825,項目名稱:git_back,代碼行數:68,代碼來源:CourseController.php

示例10: newAction

 /**
  * 新增培訓
  */
 public function newAction()
 {
     //檢查是否是ajax請求
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['tra_logo'] = $validate->getPost('tra_logo', \Validate::base64());
         //機構logo
         $data['tra_thumb'] = $validate->getPost('tra_thumb', \Validate::base64());
         //機構縮略圖
         $data['tra_name'] = $validate->getPost('tra_name', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{2,30}$/iu'));
         //學校名稱
         $data['tra_cat_id'] = $validate->getPost('tra_cat_id', \Validate::int());
         //機構分類
         $data['tra_system'] = $validate->getPost('tra_system', \Validate::int());
         //上課類型
         $data['is_join'] = $validate->getPost('is_join', \Validate::scopeCall('Setting', 'getJoin'));
         //官方合作
         $data['home_type'] = $validate->getPost('is_home', \Validate::scopeCall('Setting', 'getHome'));
         //包住宿
         $data['hire_type'] = $validate->getPost('is_hire', \Validate::scopeCall('Setting', 'getHire'));
         //包就業
         $data['tra_tel'] = $validate->getPost('tra_tel', \Validate::length(60, 0), ['slashes' => true, 'html' => true]);
         //聯係電話
         $data['tra_url'] = $validate->getPost('tra_url', \Validate::regex('/^(http(s)?:\\/\\/[^\'"\\s]+)?$/'));
         //機構官網
         $data['pro_code'] = $validate->getPost('pro_code', \Validate::regex('/^[1-9]\\d{5}$/'));
         //機構所在省份編碼
         $data['city_code'] = $validate->getPost('city_code', \Validate::regex('/^[1-9]\\d{5}$/'));
         //機構所在城市編碼
         $data['area_code'] = $validate->getPost('area_code', \Validate::regex('/^[1-9]\\d{5}$/'));
         //機構所在區縣編碼
         $data['dist_code'] = $validate->getPost('dist_code', \Validate::regex('/^0|(^[1-9]\\d{5})$/'));
         //機構所在城市編碼
         $data['tra_addr'] = $validate->getPost('tra_addr', \Validate::length(100, 0), ['slashes' => true, 'html' => true]);
         //詳細地址
         $data['tra_summary'] = $validate->getPost('tra_summary', \Validate::length(100000, 0), ['slashes' => true]);
         //機構簡介
         $data['tra_key'] = $validate->getPost('tra_key', \Validate::regex('/^([a-z0-9\\x{4e00}-\\x{9fa5}]{1,10}([\\s,][a-z0-9\\x{4e00}-\\x{9fa5}]{1,10}){0,9})?$/iu'));
         //關鍵詞
         $data['tra_desc'] = $validate->getPost('tra_desc', \Validate::length(250, 0), ['slashes' => true, 'html' => true]);
         //描述
         //驗證數據
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //生成機構logo,縮略圖
         $data['tra_logo'] = \Func::touchImg($data['tra_logo'], 'tra_logo');
         $data['tra_thumb'] = \Func::touchImg($data['tra_thumb'], 'tra_thumb');
         //將生成的圖片地址存入img,用戶失敗時刪除
         $img = [UPLOAD_PATH . $data['tra_logo'], UPLOAD_PATH . $data['tra_thumb']];
         //監測圖片是否全部生成成功
         if (!$data['tra_logo'] || !$data['tra_thumb']) {
             \FileUtil::getInstance()->unlink($img);
         }
         //新增高校
         $result = (new \Train())->addTrain($this->session->get('id'), $data);
         if ($result != 200) {
             \FileUtil::getInstance()->unlink($img);
         }
         $this->end($result);
     }
     //加載所需js
     $this->assets->addJs('backend/js/datetime/bootstrap-datepicker.js');
     $this->assets->addJs('backend/js/editors/summernote/summernote.js');
     $this->assets->addJs('backend/mt-js/train-new.js');
     //獲取省份數據
     $provinces = (new \Site())->getProvince();
     //工程屬性
     $category = (new \Train())->getCategory();
     //教學類型
     $genre = (new \Genre())->getList();
     $this->view->setVars(['provinces' => $provinces, 'category' => $category, 'genre' => $genre]);
 }
開發者ID:xw716825,項目名稱:git_back,代碼行數:76,代碼來源:TrainController.php

示例11: newAction

 /**
  * 新增小初高學校
  */
 public function newAction()
 {
     //檢查是否是ajax請求
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['sch_logo'] = $validate->getPost('sch_logo', \Validate::base64());
         //學校logo
         $data['sch_thumb'] = $validate->getPost('sch_thumb', \Validate::base64());
         //學校縮略圖
         $data['sch_name'] = $validate->getPost('sch_name', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}\\(\\)()]{2,30}$/iu'));
         //學校名稱
         $data['sch_build'] = $validate->getPost('sch_build', \Validate::regex('/^([a-z0-9\\x{4e00}-\\x{9fa5}\\(\\)\\-()]{2,30})?$/iu'));
         //學校創建時間
         $data['sch_way'] = $validate->getPost('sch_way', \Validate::length(60, 0), ['slashes' => true]);
         //入學途徑
         $data['sch_department'] = $validate->getPost('sch_department', \Validate::length(60, 0), ['slashes' => true]);
         //隸屬部門
         $data['is_join'] = $validate->getPost('is_join', \Validate::scopeCall('Setting', 'getJoin'));
         //官方合作
         $data['public_type'] = $validate->getPost('public_type', \Validate::scopeCall('Setting', 'getPublic'));
         //辦學性質
         $data['home_type'] = $validate->getPost('home_type', \Validate::scopeCall('Setting', 'getHome'));
         //住宿情況
         $data['exam_type'] = $validate->getPost('exam_type', \Validate::scopeCall('Setting', 'getExam'));
         //入學考試
         $data['stress_type'] = $validate->getPost('stress_type', \Validate::scopeCall('Setting', 'getSchStress'));
         //重點情況
         $data['sch_type'] = $validate->getPost('sch_type', \Validate::scopeCall('Setting', 'getSchType'));
         //學校類型
         $data['sch_tel'] = $validate->getPost('sch_tel', \Validate::length(60, 0), ['slashes' => true]);
         //聯係電話
         $data['pro_code'] = $validate->getPost('pro_code', \Validate::regex('/^[1-9]\\d{5}$/'));
         //學校所在省份編碼
         $data['city_code'] = $validate->getPost('city_code', \Validate::regex('/^[1-9]\\d{5}$/'));
         //學校所在城市編碼
         $data['area_code'] = $validate->getPost('area_code', \Validate::regex('/^[1-9]\\d{5}$/'));
         //學校所在區縣編碼
         $data['sch_addr'] = $validate->getPost('sch_address', \Validate::length(60, 0), ['slashes' => true, 'html' => true]);
         //詳細地址
         $data['sch_summary'] = $validate->getPost('sch_summary', \Validate::length(100000, 0), ['slashes' => true]);
         //學校簡介
         $data['sch_key'] = $validate->getPost('sch_key', \Validate::regex('/^([a-z0-9\\x{4e00}-\\x{9fa5}]{1,20}([\\s,][a-z0-9\\x{4e00}-\\x{9fa5}]{1,10}){0,9})?$/iu'));
         //關鍵詞
         $data['sch_desc'] = $validate->getPost('sch_desc', \Validate::length(250, 0), ['slashes' => true, 'html' => true]);
         //描述
         $data['sch_cost'] = $validate->getPost('sch_cost', \Validate::length(100000, 0), ['slashes' => true]);
         //收費情況
         $data['sch_lesson'] = $validate->getPost('sch_lesson', \Validate::length(200, 0), ['slashes' => true]);
         //課程體係
         $data['sch_fruit'] = $validate->getPost('sch_fruit', \Validate::length(100000, 0), ['slashes' => true]);
         //辦學成果
         $data['sch_power'] = $validate->getPost('sch_power', \Validate::length(100000, 0), ['slashes' => true]);
         //師資力量
         //驗證參數
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //生成學校logo,縮略圖
         $data['sch_logo'] = \Func::touchImg($data['sch_logo'], 'sch_logo');
         $data['sch_thumb'] = \Func::touchImg($data['sch_thumb'], 'sch_thumb');
         //將生成的圖片地址存入img,用戶失敗時刪除
         $img = [UPLOAD_PATH . $data['sch_logo'], UPLOAD_PATH . $data['sch_thumb']];
         //監測圖片是否全部生成成功
         if (!$data['sch_logo'] || !$data['sch_thumb']) {
             \FileUtil::getInstance()->unlink($img);
             $this->end(400);
         }
         //新增學校
         $result = (new \School())->addSchool($this->session->get('id'), $data);
         if ($result != 200) {
             \FileUtil::getInstance()->unlink($img);
         }
         $this->end($result);
     }
     //獲取省份數據
     $provinces = (new \Site())->getProvince();
     //加載js
     $this->assets->addJs('backend/js/editors/summernote/summernote.js');
     $this->assets->addJs('backend/js/datetime/bootstrap-datepicker.js');
     $this->assets->addJs('backend/mt-js/school-new.js');
     $this->view->setVars(['provinces' => $provinces]);
 }
開發者ID:xw716825,項目名稱:git_back,代碼行數:85,代碼來源:SchoolController.php

示例12: addAction

 /**
  * 添加陽光寶貝
  */
 public function addAction($sch_id)
 {
     //判斷是否ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['sch_id'] = $validate->getPost('sch_id', \Validate::int());
         //學校id
         $data['star_head'] = $validate->getPost('star_head', \Validate::base64());
         //學員頭像
         $data['star_name'] = $validate->getPost('star_name', \Validate::length(15, 2));
         //學員名稱
         $data['star_sort'] = $validate->getPost('star_sort', \Validate::length(99999999, 0));
         //排序
         // print_r($data);
         //驗證參數
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //生成教師頭像
         $data['star_head'] = \Func::touchImg($data['star_head'], 'star_head');
         //監測圖片是否生成成功
         if (!$data['star_head']) {
             \FileUtil::getInstance()->unlink(UPLOAD_PATH . $data['star_head']);
             $this->end(400);
         }
         //新增動態
         $this->end((new \Kindergarten())->addStar($this->session->get('id'), $data));
     }
     //加載js
     $this->assets->addJs('backend/mt-js/kindergarten-star.js');
     $this->view->setLayout('kindergarten');
     $this->view->setVars(['sch_id' => $sch_id]);
 }
開發者ID:xw716825,項目名稱:git_back,代碼行數:36,代碼來源:KindergartenController.php


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