Yii::app () method detailed

Source: Internet
Author: User

Yii::app () method detailed

1, Yii::app () returns an object of the current framework application

2, Yii::app () is an object instantiated by the Framework/web/cwebapplication.php class, so you can call properties and methods in Cwebapplication

3, Yii::app () call is the run () method in the Yii class, through which you can call other objects, methods, properties in the system

4, it is recommended not to use Yii::app () Random call Cwebapplication and the parent class CApplication related properties and methods, will affect the stability of the system

5. The components of the system can be called through Yii::app (): Session, DB, user, request, Urlmanager, etc.

Yii::app ()->user (Instantiate Cwebuser class---> "/web/auth/cwebuser.php");

Yii::app ()->db; (Instantiate Cdbconnection class---> "/db/cdbconnection.php")

Yii::app ()->session; (Instantiate Chttpsession class---> "/web/chttpsession.php")

Yii::app ()->request; (Instantiate Cwebuser class---> "/web/auth/cwebuser.php")

Yii::app ()->urlmanager (Instantiate Curlmanager class---> "/web/curlmanager.php");

Description

Framework/yiilite.php: Where is the file for each class name recorded?

Registercorecomponents () method in framework/web/cwebapplication.php: A common component name is recorded

Registercorecomponents () method in framework/base/capplication.php: A common component name is recorded

Yii::app () method detailed

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.