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)
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)
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
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!