Home > Backend Development > PHP Tutorial > Yii framework method to obtain the ID corresponding to the current control and action, yiicontrolle_PHP tutorial

Yii framework method to obtain the ID corresponding to the current control and action, yiicontrolle_PHP tutorial

WBOY
Release: 2016-07-13 10:12:18
Original
893 people have browsed it

Yii framework method to obtain the ID corresponding to the current control and action, yiicontrolle

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:

Copy code The code is as follows:
$name = $this->getId(); // controller

$name = $action->id; // action


In view:
Copy code The code is as follows:
$name = Yii::app()->controller->id; // controller

$name = $this->getAction()->getId(); // action

I hope this article will be helpful to everyone’s PHP program design based on the yii framework.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/920981.htmlTechArticleYii framework’s method of obtaining the ID corresponding to the current control and action, yiicontrolle This article describes the example of Yii framework obtaining the current control and action Method corresponding to id. Share it with everyone for your reference...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template