dqby43944
2015-10-13 11:56
浏览 46
已采纳

登录成功后,网址在yii2-app-basic中不会更改

I was going to About Page after Successfully login. It's OK.

But, URL not changing to About Page. It is same as login Page, but the content of page is About Page.

SiteController.php

public function actionLogin()
{
    if (!\Yii::$app->user->isGuest) 
    {
        return $this->goHome();
    }

    $model = new LoginForm();
    if ($model->load(Yii::$app->request->post())) 
    {
        return $this->render('about'); // Here
    }

    return $this->render('login', [
        'model' => $model,
    ]);
}

URL is same as http://localhost/myProject/yii/web/index.php?r=site%2Flogin. It should be http://localhost/mylawsuit/yii/web/index.php?r=site%2Fabout

So, how to change URL after login.? Thanks in advance.

4条回答 默认 最新

相关推荐 更多相似问题