yii + 获取 control + action

在widget里

$control = Yii::app()->getController()->id;
$action = Yii::app()->getController()->getAction()->getId();

在控制器里

获取$name = $this->getId();  // controller

$name = $action->id;  // action

在视图里

$name = Yii::app()->controller->id;  // controller

$name = $this->getAction()->getId(); // action

 

posted @ 2013-03-27 17:46  zyliang  阅读(270)  评论(0编辑  收藏  举报