//定义一些在函数外部调用的数据验证的方法
public function noEmpty($str){//验证数据是否为空,返回结果由regex函数来确定。$validate里已经有检测非空的正则表达式require,直接传递进去。
//return $this->regex($pattern,$subject);
return $this->regex('require',$str);
}
//验证Email是否正确的方法
public function isEmail($email){
return $this->regex('email',$email);
}
//验证手机号是否正确的方法
public function isMobile($mobile){
return $this->regex('mobile',$mobile);
}
//定义一个用户自定义正则表达式的验证方法
public function check($pattern,$subject){
return $this->regex($pattern,$subject);
}