Home >PHP Framework >YII >Redirect in yii cannot jump normally

Redirect in yii cannot jump normally

王林
王林Original
2020-02-20 15:15:452998browse

Redirect in yii cannot jump normally

Problem:

yii2.0 redirect cannot jump to beforeAction normally.

First look at the code:

Redirect in yii cannot jump normally

Under normal circumstances, use return $this->redirect($url);

(Recommended tutorial: yii framework)

Solution 1: Change the variable name to userid, then redirect can jump normally.

Solution 2: Use send() after redirect

$this->redirect(登录页地址)->send(); 
$this->redirect(登录页地址);Yii::$app->response->send();

Solution 3:

$this->redirect(登录页地址);
Yii::$app->end();

For more programming related content, please pay attention to php Chinese website Programming Introductory column!

The above is the detailed content of Redirect in yii cannot jump normally. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn