嗨,我在警予是新的,下面是我的UserIdentiy功能,請讓我知道我怎樣才能添加記得我的功能Yii記住我的功能?
public function authenticate()
{
$users = array();
if ($this->usertype == "registration")
{
$users = Login::model()->findByAttributes(array('email' => $this->username));
$users = $users->attributes;
}
if (empty($users)) $this->errorCode = self::ERROR_USERNAME_INVALID;
elseif (!empty($users['password']) && $users['password'] !== md5($this->password))
$this->errorCode = self::ERROR_PASSWORD_INVALID;
elseif (!empty($users['status']) && $users['status'] !== 1)
$this->errorCode = self::STATUS_NOT_ACTIVE;
else
{
$this->_id = $users->id;
$this->errorCode = self::ERROR_NONE;
}
return !$this->errorCode;
}
你檢查附帶Yii框架的演示?博客演示在登錄頁面上具有此功能。 – Jerome 2014-10-31 12:46:18
嘿,我嘗試過,但它不工作 – 2014-10-31 12:54:43