2015-02-08 51 views
2

获取当前操作在CakePHP 2我能得到通过$this->action当前动作,但在CakePHP中3.X我再也不能用这个,因为它返回以下错误:CakePHP中3

Error: actionHelper could not be found. 

如何在CakePHP 3中获取当前操作?

+0

'$ this-> action'已经在2.x中被定义了! – mark 2015-02-08 21:48:51

回答

11

$this->request->action$this->request->params['action']两者都有效。

+0

是的,这将工作! – Chandresh 2015-02-09 06:25:08

+0

它没有给出正确的操作名称,只有第二个URL参数。 – afilina 2015-11-20 13:19:49

+0

谢谢...为我工作 – mostafaznv 2016-08-29 13:30:54