Every time the Yii application starts processing an HTTP request, it will go through an approximate process. (Recommended learning: yii tutorial )
user submit a request to the inlet script web/index.php.
The entry script will load the configuration array and create an application instance to handle the request.
The application will resolve the requested route through the request application component.
The application creates a controller instance to specifically handle the request.
The controller will create an action instance and execute the relevant Filters (access filters) for the action.
If any filter fails to verify, the action will be cancelled.
If all filters pass, this action will be executed.
The action will load a data model, usually from the database.
The action renders a View and provides it with the required data model.
The rendered result will be returned to the response (response) application component.
The response component will send the rendering result back to the user's browser.
The diagram below shows how the application handles a request.
The above is the detailed content of The operating mechanism of the yii framework. For more information, please follow other related articles on the PHP Chinese website!