2017-03-04 23:43:10 2647次浏览 1条回答 0 悬赏 10 金钱

The page isn’t redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

    'defaultRoute' => 'admin/login',    //配置默认路由
    public function actionLogin()
    {
        if (!Yii::$app->user->isGuest) {
            return $this->goHome();
        }
        $model = new LoginForm();
        if ($model->load(Yii::$app->request->post()) && $model->login()) {
            return $this->goBack();
        } else {
            return $this->renderPartial('login', [
                'model' => $model,
            ]);
        }
    }

设置默认为管理员登录页面, 奇怪了换成别的路由却能用? 求解释

补充于 2017-03-04 23:56

我好像找到原因了, 是我之前登录状态没有 logout() 注销, 所以直接 return $this->goHome(); 可是为啥不进入正确的页面反而报错呢 ? 疑惑

  • 回答于 2017-03-05 09:44 举报

    不是提示重定向错误吗?不应该是你登陆状态影响结果。
    你的goHome有正确的地址不?

    1 条回复
    回复于 2017-03-05 10:30 回复

    有呀, goHome 就是返回上次没有推出前的页面吧

您需要登录后才可以回答。登录 | 立即注册
tw1996
见习主管

tw1996

注册时间:2016-03-13
最后登录:2020-03-25
在线时长:37小时2分
  • 粉丝3
  • 金钱0
  • 威望0
  • 积分370

热门问题