|
|
@ -69,27 +69,7 @@ |
|
|
|
['pwdConfirm','compare','compareAttribute'=>'password','message'=>'两次密码必须一致'], |
|
|
|
[['name','email','password','pwdConfirm'],'required','on'=>'register'], |
|
|
|
[['name','password'],'required','on'=>'login'], |
|
|
|
[['name','email'],'Wiggins\MyProject\MyValidator'] |
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* MyValidator类用于独立验证器 |
|
|
|
* @author kuangweijian <867034892@qq.com> |
|
|
|
* @since 1.0.0 |
|
|
|
*/ |
|
|
|
class MyValidator extends Validator |
|
|
|
{ |
|
|
|
public function validateAttribute($model, $attribute) |
|
|
|
{ |
|
|
|
$blackList='kuangweijian'; |
|
|
|
if(in_array($blackList, $model->attributes)) //判断黑名单是否在属性数组中
|
|
|
|
{ |
|
|
|
$this->addError($model, $attribute,"{$blackList}属于黑名单人员"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
?>
|