php yii 小计:获取module controller action id

来源:互联网 发布:vm安装mac 编辑:程序博客网 时间:2024/05/29 07:39

在控制器里

$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

原创粉丝点击