发布于 1970-01-01 08:00
  • 1 个回答
    • ...那个login本来就不在common\model\User.php里,另外Yii::$app->user里的这个user也不是common\model\User.php,而是yii\web\User,那么login也就找到了;

      public function login(IdentityInterface $identity, $duration = 0)
          {
              if ($this->beforeLogin($identity, false, $duration)) {
                  $this->switchIdentity($identity, $duration);
                  $id = $identity->getId();
                  $ip = Yii::$app->getRequest()->getUserIP();
                  if ($this->enableSession) {
                      $log = "User '$id' logged in from $ip with duration $duration.";
                  } else {
                      $log = "User '$id' logged in from $ip. Session not enabled.";
                  }
                  Yii::info($log, __METHOD__);
                  $this->afterLogin($identity, false, $duration);
              }
      
              return !$this->getIsGuest();
          }
      
      2022-12-01 22:14 回答
    撰写答案
    今天,你开发时遇到什么问题呢?
    立即提问
    PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
    Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有