1.

How to get current action & controller name in YII2?

Answer»

Developers can get the controller NAME in Yii2 throigh this method -

//Controller Name
ECHO Yii::$app->controller->id;

We can also get CURRENT action through this method:
echo Yii::$app->controller->action->id;



Discussion

No Comment Found