YII 控制器的调用,在其它控制器中

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

                一个contoller CustomerController里怎么调用另一个controller里的action,Acontoller调用SiteContoller的actionShow($id), url显示上是Customer/index


$control=Yii::app()->runController('site/show/id/2');
不带参数的actionShow()


$control=Yii::app()->runController('site/show');
redirect使用方法


$this->redirect(array('/site/contact','id'=>12));
//http://www.localyii.com/testwebap/index.php?r=site/contact&id=12


$this->redirect(array('site/contact','id'=>'idv','name'=>'namev'));
//http://www.localyii.com/testwebap/index.php?r=site/contact&id=idv&name=namev


$this->redirect(array('site/contact','v1','v2','v3'));
//http://www.localyii.com/testwebap/index.php?r=site/contact&0=v1&1=v2&2=v3


$this->redirect(array('site/contact','v1','v2','v3','#'=>'ttt'));
//带anchor的 http://www.localyii.com/testwebap/index.php?r=site/contact&0=v1&1=v2&2=v3#ttt
跳转到一个绝对路径


$this->redirect('http://www.baidu.com');           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow

这里写图片描述

猜你喜欢

转载自blog.csdn.net/ufryyfdf/article/details/84077059