作者:zccst
一个contoller里怎么调用另一个controller里的action,Acontoller调用SiteContoller的actionShow($id),
redirect使用方法
跳转到一个绝对路径
如果您觉得本文的内容对您的学习有所帮助,您可以微信:
[img]http://dl2.iteye.com/upload/attachment/0109/0668/fb266dfa-95ca-3d09-b41e-5f04a19ba9a1.png[/img]
一个contoller里怎么调用另一个controller里的action,Acontoller调用SiteContoller的actionShow($id),
$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');
如果您觉得本文的内容对您的学习有所帮助,您可以微信:
[img]http://dl2.iteye.com/upload/attachment/0109/0668/fb266dfa-95ca-3d09-b41e-5f04a19ba9a1.png[/img]