本文整理汇总了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]);
}
示例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']]);
}
示例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]);
}
示例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]);
}
示例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');
}
示例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]);
}
示例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]);
}
示例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));
}
}
示例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');
}
示例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');
}
示例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]);
}
示例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('专题添加成功');
}
示例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]);
}
示例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');
}
示例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);
}