Yii Framework gets the current Controlle and action corresponding ID, yiicontrolle_php tutorial

Source: Internet
Author: User

The YII framework obtains the current Controlle and action corresponding IDs, Yiicontrolle


This example describes the YII framework's approach to obtaining the current Controlle and action corresponding IDs. Share to everyone for your reference. Here's how:

In YIII framework development, you may want to get the ID of the current Controlle or action, in fact it is very simple, a code is implemented, the following is the code to get the current ID in the Controlle (Controller) and view (view) respectively.

In the controller:
Copy the Code code as follows: $name = $this->getid (); Controller

$name = $action->id; Action
In the View:
Copy the Code code as follows: $name = Yii::app ()->controller->id; Controller

$name = $this->getaction ()->getid (); Action

It is hoped that this article is helpful to the PHP program design based on YII framework.

http://www.bkjia.com/PHPjc/920981.html www.bkjia.com true http://www.bkjia.com/PHPjc/920981.html techarticle The Yii framework obtains the current Controlle and action corresponding IDs, Yiicontrolle This example describes the YII framework to obtain the current Controlle and action corresponding ID method. Share to everyone for your reference ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.