Browse Source

添加注释

master
kuangweijian 3 years ago
parent
commit
c6420c477f
  1. 9
      src/validators/MyValidator.php

9
src/validators/MyValidator.php

@ -10,7 +10,14 @@
*/ */
class MyValidator extends Validator 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"; $blackList="kuangweijian1";
if((strcmp($blackList, $model->{$attribute})==0)) if((strcmp($blackList, $model->{$attribute})==0))

Loading…
Cancel
Save