In View(CakePHP), the proper way to get current controller?

前端 未结 8 846
伪装坚强ぢ
伪装坚强ぢ 2021-02-02 07:36

In View, I can get action by using

$this->action

But, I cannot get controller name by

$this->controller
8条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-02 08:20

    To get the current controller, Try this :$this->params['controller']

    To get the current action, Try this :$this->params['action'].

提交回复
热议问题