我有这样的事情:
$data = array('username' => 'John', 'password' => 'john123');
$table = new Zend_Db_Table('users');
$table->insert($data);
但我希望它在密码中加入散列函数,所以sql是这样的:
INSERT INTO `users` (`username`, `password`) VALUES ('John', PASSWORD('john123'));
我怎么能优雅地做到这一点?
答案 0 :(得分:1)
$data = array('username' => 'John', 'password' => new Zend_Db_Expr('SHA1(john123)');