获取控制器和方法的ID
转载:http://code.dimilow.com/how-to-get-current-controller-name-and-action-name-in-yii/
How to get current controller name and action name in Yii
By Dimi Low on July 7th, 2010 (6 responses)
To get current controller name/id inside your controller, or view
$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
//inside beforeAction or afterAction
public function beforeAction($action)
{
$actionId = $action->id;
...
or just elsewhere inside your controller
$actionId = $this->getAction()->getId();