Home >Backend Development >PHP Tutorial >Yii framework method to obtain the ID corresponding to the current control and action, yiicontrolle_PHP tutorial
The example in this article describes the method of Yii framework to obtain the ID corresponding to the current control and action. Share it with everyone for your reference. The specific method is as follows:
In Yiii framework development, you may want to get the id of the current control or action. It is actually very simple. It can be achieved with just one line of code. The following is how to get the current id in the controller and View respectively. code.
In the controller:
$name = $action->id; // action
$name = $this->getAction()->getId(); // action
I hope this article will be helpful to everyone’s PHP program design based on the yii framework.