namespace app\controllers
use Yii;
Class TestController extends Controller{
public function actionTest(){
$this->redirect(\Yii::$app->urlManager->createUrl("test/show"));
}
public function actionShow(){
//your action here
}
}
In above example when we visit test/test then this action redirect to show method of the test class. We can redirect to any action of any controller by using this method. $this refers to the TestController and use redirect method of parent class and urlManager is ued to create valid url.
No comments:
Post a Comment