123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
-
-
- namespace app\admin\validate;
- use think\Validate;
-
- class ConfigAttribute extends Validate
- {
-
- protected $rule = array(
- array('inc_type','checkIncType'),
- array('attr_name','require','变量名称不能为空'),
- array('attr_input_type', 'require', '请选择表单类型'),
- );
-
-
-
- protected function checkIncType($inc_type, $rule)
- {
- if(empty($inc_type) || I('param.inc_type/s', '') == '')
- return '缺少变量前缀';
- else
- return true;
- }
-
-
-
- protected function checkAttrValues($attr_values,$rule)
- {
- if(empty($attr_values) && I('param.attr_input_type/d') == '1')
- return '可选值列表不能为空';
- else
- return true;
- }
- }
|