How to get current action & controller name in yii2?
Answer / Aneer Yadav
In Yii2, you can use the following code to get the current action and controller names:
```php
$controllerId = Yii::$app->controller->id;
$actionId = Yii::$app->controller->action->id;
```
| Is This Answer Correct ? | 0 Yes | 0 No |
What are the core application components available on yii?
What is gii in yii 2.0 and why it is used?
What are the requirements of the yii?
Explain the difference between homeurl and baseurl in yii2?
What is required properties in yii application? Why?
What is components in yii?
What are the type of models available in yii framework ?
What is yii 2?
How do we extend yii?
How to get current controller id in yii ?
What is cactiverecord in yii framework ?
How to use module components and aliases?