mmoven12 2011-07-01 14:28:22 5762次浏览 4条回复 0 0 0
public function authenticate() 
{
  $user = User::model()->findByAttributes(array('username' => $this->username));
  if ($user === null) {
    $this->errorCode = self::ERROR_USERNAME_INVALID;
  } else {
    if ($user->password !== $user->encrypt($this->password)) {
      $this->errorCode = self::ERROR_PASSWORD_INVALID;
    } else {
      $this->_id = $user->id;
    if (null === $user->last_login_time) {
      $lastLogin = time();
    } else {
      $lastLogin = strtotime($user->last_login_time);
    }
    $this->setState('lastLoginTime', $lastLogin);
    $this->errorCode = self::ERROR_NONE;
    }
  }
  return!$this->errorCode;
}

倒数第二行 为什么要取非 errorCode不是在CDbUseridentity类中定义好了 为什么要取非? 跪求指点啊

您需要登录后才可以回复。登录 | 立即注册