php yii 小计:获取module controller action id

在控制器里

$name = $this->getModule()->id; // module

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

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

在视图里,除了上述2个方法还可:

$name = $this->module->id; // module

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

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

你可能感兴趣的:(二次开发,基础编程)