From c6420c477ffc5f6e926ffb4230a15a705dcab838 Mon Sep 17 00:00:00 2001 From: kuangweijian <867034892@qq.com> Date: Mon, 28 Mar 2022 15:22:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/validators/MyValidator.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/validators/MyValidator.php b/src/validators/MyValidator.php index 0a7fed0..5c3d5d3 100644 --- a/src/validators/MyValidator.php +++ b/src/validators/MyValidator.php @@ -10,7 +10,14 @@ */ class MyValidator extends Validator { - public function validateAttribute($model, $attribute) + /** + * 对指定的属性进行验证 + * + * @param yii\base\Model $model 被校验的数据模型 + * @param string $attribute 被校验的属性名称 + * @return bool 验证成功返回true,验证失败返回false + */ + public function validateAttribute($model, $attribute) : bool { $blackList="kuangweijian1"; if((strcmp($blackList, $model->{$attribute})==0))