首页 > 其他 > 详细

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

时间:2014-03-27 04:01:18      阅读:434      评论:0      收藏:0      [点我收藏+]

一个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‘);

更多:
http://blog.csdn.net/qmhball/article/details/8031833

Yii框架下不同contoller之间的方法调用,布布扣,bubuko.com

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

原文:http://www.cnblogs.com/youxin/p/3627263.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!