2015-02-08 37 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