0

我使用以下代码对密码进行哈希处理:

$password = $_POST['user_pass'];
$hash = wp_hash_password('$password');

我错过了什么?我得到的错误是

错误:您为用户名willshatner输入的密码不正确。

4

2 回答 2

1

由于单引号,此代码不会输入您发送的密码:

$hash = wp_hash_password('$password'); // here the password is set to the string $password

请改用此代码:

$hash = wp_hash_password($password); // here the password is set to the value of the variable $password
于 2013-04-15T20:28:12.000 回答
-1

由于密码是 MD5 加密的,您可能必须加密 POST 以匹配数据库

      $password = MD5($_POST['user_pass']);
于 2013-04-15T20:19:34.640 回答