Application Components
Application Components
Applications are service locators. They host a set of the so-called application components that provide different services for processing requests. For example, the urlManager
component is responsible for routing Web requests to appropriate controllers; the db
component provides DB-related services; and so on.
Each application component has an ID that uniquely identifies itself among other application components in the same application. You can access an application component through the expression:
\Yii::$app->componentID
For example, you can use \Yii::$app->db
to get the 登录查看完整内容