在控制器里

$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

 

相关文章:

  • 2021-11-12
  • 2022-12-23
  • 2021-06-03
  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-07
  • 2022-12-23
  • 2022-12-23
  • 2021-12-17
相关资源
相似解决方案