且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

验证密码登录始终为false使用Yii 2

更新时间:2023-12-03 20:44:34

我觉得你做在数据库中的错误。也许,你的密码字段有VARCHAR(32),(你写了这是正常的,当我使用MD5密码)。

I think you made a mistake in the database. Perhaps, your password field has VARCHAR(32) (you wrote "it's normal when i used md5 password.").

Yii::$app->getSecurity()->generatePasswordHash($password);

这个函数生成字符串的长度超过32个字符。对于密码字段,请使用文本,而不是VARCHAR(32)。

This function generates the string is longer than 32 characters. For the password field, use the TEXT instead of VARCHAR(32).