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

前端 未结 8 795
伪装坚强ぢ
伪装坚强ぢ 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条回答
  • 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'].

    0 讨论(0)
  • 2021-02-02 08:22

    I am using cakephp 3.2

    $this->params['controller'] - It is not working, showing error message as bellow..
    

    "Missing Helper"

    Following code is working properly in cakephp 3.2

    $this->request->params['controller'] - Working
    
    0 讨论(0)
提交回复
热议问题