Function Description:
1. Background check: The default value is assigned if the value is null when validating.
2. Foreground check: Check when the mouse loses focus, if there is a non-null (required) check, non-null authentication is performed first, and if null authentication is empty, the default value is automatically populated after the mouse loses focus.
How to use:
In the rules () function call $rules[] = model::addrule (' cat_sort ', ' Default ', [' value ' = ' 255 ']);
Parameter description:
1. Authenticator Name: Default
2. Parameter value specifies the default value for the property.
When the mouse gets focus empty text box:
Auto-complete with default values after the mouse loses focus:
The above describes the Yii validator Defaultvalidator-default validator, including the aspects of the content, I hope to be interested in PHP tutorial friends helpful.