在CakePHP 2中,我可以通过使用$this->action
来获得当前操作,但在CakePHP3.x中,我不能再使用它了,因为它返回以下错误:
Error: actionHelper could not be found.
如何在CakePHP 3中获取当前操作?
$this->request->action
或$this->request->params['action']
都有效。
在CakePHP 3.7中使用:
$this->getRequest()->getParam('action')
从CakePHP 3.6开始使用不推荐使用的$this->request->getParam('action')