当前位置:Gxlcms > PHP教程 > YII2登录验证是出错!详见如下。。。

YII2登录验证是出错!详见如下。。。

时间:2021-07-01 10:21:17 帮助过:5人阅读

Getting unknown property: common\models\User::password_hash

这是为什么呢?

回复内容:

Getting unknown property: common\models\User::password_hash

这是为什么呢?

你不知道翻译下这句话?
未知的属性password_hash
你在common\models\User加上$password_hash这个属性就行了,注意是public的。

class User extends \yii\db\ActiveRecord implements IdentityInterface{
    public $password_hash;
    //more code
}

明显是缺少这个字段,题主应该是按照yii2 by example 那本书敲的代码吧。那里面库超里用了这个字段名,通常可能你用了password这个名称

人气教程排行