我在 yii 中使用 $model->validate() .. 所有验证都通过但 $model->save() 不起作用。我能做些什么来解决这个问题?提前致谢。
这是我的控制器:
$model = new BaseSysRegistration();
$model->attributes = $_POST['BaseSysRegistration'];
$model->of_passport_number = $_POST['of_passport_number'];
$model->password2 = $_POST['BaseSysRegistration']['password'];
$model->email_addr = $_POST['BaseSysRegistration']['email_addr'];
$model->security_question_1_id = $_POST['BaseSysRegistration']['security_question_1_id'];
$model->security_question_1_answer = $_POST['BaseSysRegistration']['security_question_1_answer'];
if($model->validate()){
$model->save();
}