4.3.8 Validate类

ShopNC

4.3.8      Validate

Validate():验证数组中的值

Check():正则表达式运算

setValidate():需要验证的内容

getError():得到验证的错误信息

Validate类使用示例:

//创建验证类

$obj_validate = new Validate();

$obj_validate->validateparam = array(

array("input"=>$_POST["username"],"require"=>"true","message"=>'用户名不能为空'),

array("input"=>$_POST["password"],"require"=>"true","message"=>'密码不能为空'),

array("input"=>$_POST["email"],    "require"=>"true","validator"=>"email","message"=>'请正确填入Email'),

);

$error $obj_validate->validate();

if ($error != ''){

//输出错误信息

showDialog($error);

}

 


Copyright ©2009 - 2014 shopnc.net.All rights reserved.
Powered By ShopNC