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;
BY Best Interview Question ON 01 Feb 2019