Required: required value verification attribute [[field name], required, requiredValue & gt; required value, message & gt; prompt information]; # Description: alias of CRequiredValidator, ensure that the feature is not empty. required: required value verification attribute
[['Field name'], required, 'requiredvalue '=> 'required value', 'message' => 'Prompt information']; # Description: alias of CRequiredValidator, ensure that the feature is not empty.
Email: email verification
['Email ', 'Email']; # Note: the alias of CEmailValidator ensures that the feature value is a valid email address.
Match: regular expression verification
[['Field name'], match, 'pattern' => 'regular expression', 'message' => 'Prompt information']; [['Field name'], match, 'Not '=> ture, 'pattern' => 'regular expression', 'message' => 'Prompt information'];/* reverse regex */# description: the alias CRegularExpressionValidator ensures that the feature matches a regular expression.
Url: url
['Website', 'URL', 'defaultscheme '=> 'http']; # Note: the alias of CUrlValidator ensures that the feature is a valid path.
Captcha: verification code
['Notificationcode', 'captcha ']; # Note: the alias of CCaptchaValidator ensures that the value of the feature is equal to the verification code displayed by captcha.
Safe: Secure
['description', 'safe'];
Compare: Comparison
['Age', 'compute', 'compute' => 30, 'operator' => '> =']; # Description: compareValue (constant value) -operator (comparison operator) # Description: the alias of CCompareValidator, which ensures that the feature value is equal to another feature or constant.
Default: default value
['Age', 'default', 'value' => null]; # Description: the alias of CDefaultValueValidator. a default value is assigned to the feature.
Exist: exist
['Username', 'exist']; # Description: the alias of CExistValidator. make sure that the attribute value exists in the specified data table field.
File: file
['Primaryimag', 'file', 'extension' => ['PNG ', 'jpg', 'GIF'], 'maxsize' => 1024*1024*1024]; # Note: the alias of CFileValidator ensures that the feature contains the name of an uploaded file.
Filter: filter
[['Username', 'Email '], 'filter', 'filter' => 'trim', 'skiponarray' => true]; # Description: alias of CFilterValidator, use a filter to convert attributes.
In: Range
['Level', 'in', 'range' => [1, 2, 3]; # Description: alias of CRangeValidator, make sure that the feature appears in a reserved value list.
Unique: Uniqueness
['Username', 'Unique'] # Note: the alias of CUniqueValidator ensures that the feature is unique in data table fields.
Integer: integer
['age', 'integer'];
Number: number
['salary', 'number'];
Double: double floating point type
['salary', 'double'];
Date: date
[['from', 'to'], 'date'];
String: string
['username', 'string', 'length' => [4, 24]];
Boolean: whether it is a boolean value.
['Field name', 'boolean', 'truevalue '=> true, 'falsevalue' => false, 'strict' => true]; # Description: alias of CBooleanValidator
Image: whether it is a valid image file
['primaryImage','image', 'extensions' => 'png, jpg,jpeg','minWidth' => 100,'maxWidth' => 1000,'minHeight' => 100,'maxHeight' => 1000,]
If you have any questions, you can leave a message to add them. Mutual learning