Loading…

How to get current action & controller name in YII2?

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;

Suggest An Answer

No suggestions avaliable!

Latest post from Yii 2 interview questions

Ask Question