-1
我想在将密码插入数据库之前更改要加密的密码,但它不起作用。它说密码很长。用Yii加密的密码问题
public function actionCreate() {
$model = new Users;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Users'])) {
$model->attributes = $_POST['Users'];
$password = $_POST['Users']['password'];
$model->password = md5($password);
if ($model->save())
$this->redirect(array('view', 'id' => $model->id));
}
$this->render('create', array(
'model' => $model,
));
}
增加tabel中的密码字段的大小以及用户模型中的规则的大小也会增加该大小,以使您的模型验证结果为true。 – 2014-09-26 10:45:09
您在模型类规则中使用的密码长度是多少? – Athipatla 2014-09-26 11:14:28
你的回答是正确的milz谢谢男人:) – 2014-09-26 11:36:19