Home > PHP Framework > YII > body text

What does Yii::app() mean?

(*-*)浩
Release: 2019-11-04 13:20:21
Original
3486 people have browsed it

What does Yii::app() mean?

Yii::app() is an instantiated object, an object that we can directly operate in the current framework. We can understand this object as a request application first object.

Yii framework is a pure OOP object-oriented framework, which uses objects to call attributes and methods of classes to complete application requests. (Recommended learning: yii tutorial)

What does Yii::app() mean?

Through the analysis of the above figure, we know that Yii::app() is the first in the system The object is the boss. We can use this object to call other related methods, properties, and objects in the system.

Yii::app() is an object instantiated by the CwebApplication class

CwebApplication(framework/web/CwebApplication.php)
Copy after login

Therefore, Yii::app() can call related properties or methods in CwebApplication or the parent class CApplication.

Note: Do not access related methods of CwebApplication or its parent class casually, as it will affect system stability.

System application components

We can call system components through Yii::app()

User session request log db, etc.

In the system The above components can be directly accessed from any corner

Yii ::app()->user  (实例化对象'CWebUser' => '/web/auth/CWebUser.php',)
Yii ::app()->session(实例化'CHttpSession')
Yii ::app()->request
Yii ::app()->db
Copy after login

The above is the detailed content of What does Yii::app() mean?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
yii
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