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?
高洛峰2017-05-17 09:57:59
Override rules
Method
class Model extends \yii\db\ActiveRecord
{
//...
public function rules() {
$rules = parent::rules();
$rules[] = [['phone'],'integer','message'=>'手机号码必须是数字'];
return $rules;
}
//...
}