【发布时间】:2015-07-02 11:09:54
【问题描述】:
我正在使用以下代码。但它不会更新为哈希值。只是保存为输入值。请帮忙。
$this->request->data['User']['password'] = md5($this->request->data['User']['password']);
if ($this->User->updateAll(array('User.password' => $this->request->data['User']['password']),array('User.id' => $newsid))) {
$this->Session->setFlash("Password Changed");
$this->redirect(array('controller' => 'admins', 'action' => 'login'));
} else {
$this->Session->setFlash("password not changed");
$this->render();
}
【问题讨论】:
-
您好,在 cake php 中,密码字段不需要 md5,您在 cakephp 中使用什么版本?
-
但是通过这段代码。如何将密码保存为哈希值?
-
你遇到了什么错误? ,你需要更新一行还是所有行?
-
Column not found: 1054 Unknown column 'c920c1595dcdb710a8cbd045b9735acb' in 'field list' UPDATE
demo.usersASUserSETUser.password= c920c1595dcdb710a8cbd045b9735acb WHEREUser.id= 7