频道栏目
首页 > 资讯 > Yii > 正文

Yii框架下不同contoller之间的方法调用——redirect

16-01-07        来源:[db:作者]  
收藏   我要投稿

一个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')。
相关TAG标签
上一篇:大家好,小妹在此报道,顺便请问个有关问题
下一篇:如何样能在指定的表格位置输出一个*号
相关文章
图文推荐

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站