For example, I want to add a verification for field A, but it does not exist in the database. An error will be reported at this time. Are there any parameters that can be set?
人生最曼妙的風景,竟是內(nèi)心的淡定與從容!
Override rules
Method
class Model extends \yii\db\ActiveRecord
{
//...
public function rules() {
$rules = parent::rules();
$rules[] = [['phone'],'integer','message'=>'手機號碼必須是數(shù)字'];
return $rules;
}
//...
}