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


PHP obj::setValidate方法代码示例

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


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

示例1: addComment

 /**
  * 发表评论
  *
  */
 private function addComment()
 {
     $input_param = array();
     $input_param['user_id'] = intval($_SESSION['userinfo']['user_id']);
     $input_param['goods_id'] = intval($this->_input['goods_id']);
     $input_param['comment_body'] = trim($this->_input['comment_body']);
     /*验证信息*/
     $this->objvalidate->setValidate(array('input' => $input_param['user_id'], 'require' => "true", 'message' => $this->_lang['product_good_comment_login']));
     $this->objvalidate->setValidate(array('input' => $input_param['comment_body'], 'require' => "true", 'message' => $this->_lang['product_good_comment_null']));
     /*判断验证码是否开启*/
     if ($this->_viewinfo['websit']['view_comment_validate'] == '1') {
         $this->objvalidate->setValidate(array('input' => strtoupper($this->_input['txt_comment_code']), 'require' => "true", "validator" => "Compare", "operator" => "==", "to" => strtoupper($_SESSION['seccode']), 'message' => $this->_lang['product_good_code_error']));
     }
     $error = $this->objvalidate->validate();
     if ($error) {
         $this->showMessage($error, $this->refer_url, 1);
     }
     if ($input_param['comment_body'] != "") {
         $result = $this->obj_comment->addGoodsComment($input_param);
         if ($result) {
             $this->showMessage($this->_lang['product_good_comment_succ'], $this->_configinfo['websit']['site_url'] . "/product.php?id=" . $input_param['goods_id'], 1, 2000);
         } else {
             $this->showMessage($this->_lang['product_good_comment_error'], $this->_configinfo['websit']['site_url'] . "/product.php?id=" . $input_param['goods_id'], 1, 2000);
         }
     } else {
         $this->showMessage($this->_lang['product_good_comment_null'], $this->_configinfo['websit']['site_url'] . "/product.php?id=" . $input_param['goods_id'], 1, 2000);
     }
 }
开发者ID:jn7163,项目名称:ShopNC,代码行数:32,代码来源:product.php

示例2: saveGoodsClass

 /**
  * 保存商品分类
  *
  */
 private function saveGoodsClass()
 {
     /*权限检查*/
     $this->checkAdmin('goods_class_add');
     $input_param['txt_class_top_id'] = intval($this->_input['txt_class_top_id']);
     //父级分类id
     $input_param['txt_class_name'] = trim($this->_input['txt_class_name']);
     //分类名称
     $input_param['txt_class_state'] = intval($this->_input['txt_class_state']);
     //分类状态0、开启1、关闭
     $input_param['txt_class_keywords'] = trim($this->_input['txt_class_keywords']);
     //分类关键字
     $input_param['txt_class_description'] = trim($this->_input['txt_class_description']);
     //分类描述
     $input_param['txt_class_sort'] = intval($this->_input['txt_class_sort']);
     //分类排序
     $input_param['txt_class_language'] = intval($this->_input['txt_class_language']);
     //分类语言显示
     $input_param['txt_class_url'] = trim($this->_input['txt_class_url']);
     //分类指向的url外联
     $input_param['txt_class_menu'] = intval($this->_input['txt_class_menu']);
     //是否导航显示
     $input_param['txt_class_language'] = intval($this->_input['txt_class_language']);
     //选择语言
     $input_param['txt_goods_type_id'] = intval($this->_input['txt_goods_type_id']);
     //商品类型
     $input_param['txt_modify_sub'] = intval($this->_input['modify_sub']);
     //修改范围
     $input_param['txt_class_attr'] = serialize(array_filter($this->_input['txt_class_attr'], 'htmlspecialchars'));
     //序列化特殊属性
     /**
      * 验证注册信息
      */
     $this->obj_validate->setValidate(array("input" => $input_param['txt_class_name'], "require" => "true", "message" => $this->_lang['admin_goods_class_name_is_null']));
     //分类名称不能为空
     $error = $this->obj_validate->validate();
     if ($error != "") {
         //返回错误信息
         $this->adminMessage($error, $this->_configinfo['websit']['site_url'] . "/admin/admin_goods_class.php?action=page_goods_class", 1, 4000);
     } else {
         if ($this->_input['class_id'] != "") {
             $class_id = intval($this->_input['class_id']);
             //检查修改的分类topid是否是当前分类的下级,如果是返回错误,不是的话,正常进行
             $productClassArray = $this->obj_goods_class->listClassDetail("");
             $class_top_id = $input_param['txt_class_top_id'];
             $sub_class = $this->obj_goods_class->getArrayById($productClassArray, $result, $class_id);
             $sub_class[] = $class_id;
             if ($sub_class != null) {
                 if (in_array($class_top_id, $sub_class)) {
                     $this->adminMessage($this->_lang['admin_goods_class_list_move_error'], $this->refer_url, 1, 3000);
                 }
             }
             $rs = $this->obj_goods_class->modifyGoodsClass($input_param, $class_id);
         } else {
             $rs = $this->obj_goods_class->addGoodsClass($input_param);
         }
         if ($rs) {
             $this->obj_goods_class->createGoodsClassArray();
             /*日志保存*/
             $log_array = array();
             $log_array['log_info'] = $this->_lang['admin_goods_class_save_ok'];
             $this->obj_log->inLog($log_array);
             $this->adminMessage($this->_lang['admin_goods_class_save_ok'], $this->_configinfo['websit']['site_url'] . "/admin/admin_goods_class.php?action=list", 1, 1000);
         } else {
             /*日志保存*/
             $log_array = array();
             $log_array['log_info'] = $this->_lang['admin_goods_class_save_false'];
             $this->obj_log->inLog($log_array);
             $this->adminMessage($this->_lang['admin_goods_class_save_false'], $this->_configinfo['websit']['site_url'] . "/admin/admin_goods_class.php?action=page_goods_class", 1, 4000);
         }
     }
 }
开发者ID:jn7163,项目名称:ShopNC,代码行数:76,代码来源:admin_goods_class.php


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