通知短信+运营短信,5秒速达,支持群发助手一键发送🚀高效触达和通知客户 广告
# 数据验证 表单数据验证Validate类 ``` $config = array(        array('string'=>'name' , 'require' => true , 'info' => '名称为必填项!'),        array('string'=>'message' , 'require' => true , 'info' => '留言内容不能为空!'),     array('string'=>'message' , 'minlength' => 5 , 'info' => '留言内容不能小于5位哦!'),     array('string'=>'email' , 'validate' => 'email' , 'info' => '邮箱格式不正确!'), ); $valiedate = new \system\Validate($config); $data = $valiedate->Validate(); ``` 初始化 ``` //new出一个Validate类 $validate = new \system\Validate('验证数组' , '验证报错函数'); ``` 数组参数(无需按照顺序填写) 属性名 属性解释 string 表单名 require 验证规则 系统还提供了 minlength、maxlength info 错误提示信息 validate 验证方式 现在有的 email validate\_patten 验证正则验证报错函数 默认函数为showMessage 可更换其他函数 开始验证 ``` //验证过后,会返回验证的数据值 $data = $valiedate->Validate(); ``` 验证单个表单字段 ``` //验证用户名必填  $data = $valiedate->Validate('username' , array(        array('string' => 'username' , 'require' => true , 'info' => '用户名为必填!') )); ```