Home > Article > PHP Framework > 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));
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(); //提交后 防止重复提交
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!