To get current controller name/id inside your controller, or view
1 2 3 | $controllerId = Yii::app()->controller->id; //or $controllerId = $this->getId(); |
To get current action name/id being executed, if you are inside beforeAction() or afterAction(), use the received CAction argument
1 2 3 4 5 | //inside beforeAction or afterAction public function beforeAction($action) { $actionId = $action->id; ... |
or just elsewhere inside your controller
1 | $actionId = $this->getAction()->getId(); |
Recent Comments