Home > PHP Framework > YII > How to jump to the page in Yii framework?

How to jump to the page in Yii framework?

Guanhui
Release: 2020-06-18 15:11:58
Original
3540 people have browsed it

How to jump to the page in Yii framework?

#How to jump to the page in Yii framework?

In the Yii framework, you can jump to the page by using the "redirect()" method. The function of this method is to redirect to a URL address. Its syntax is "redirect($url)" and its parameters $url represents the URL to be jumped. When using it, you need to call it in the controller and pass in the URL.

Usage examples

$this->redirect(array('跳转到的controller/跳转到的controller里的action','参数'=>'值',,,,));
$this->redirect(array('user/getuser','id'=>1));
Copy after login

Jump parameters

$this->goHome(); //返回首页
$this->goBack(); //#返回,如果上一页还是该页,那么会造成无限重定向。
Yii::app()->request->referrer; //上一页url

Yii::app()->request->hostInfo; //当前域名
Yii::app()->request->getUrl(); //当前URL
Yii::app()->user->returnUrl; //返回首页
controler->refresh(); //提交后 防止重复提交
Copy after login

Recommended tutorial: " Yii Tutorial

The above is the detailed content of How to jump to the page in Yii framework?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
yii
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template