Analysis of the process of Zend framework processing an http request

Source: Internet
Author: User

 

1. The first step is the bootstrap Process, which initializes the resources used in the program.

2. Create a Zend_Controller_Front object to implement the front controller mode. This entity class is responsible for sending http requests to the action of the appropriate controller.

3. The Front controller creates two objects to encapsulate http requests and http replies: Zend_Controller_Request_Http and Zend_Controller_Response_Http.

4. The Front controller creates two objects for url seeking and dispatch, routing and dispatcher, and finds the controllers and actions that the specified url should execute, and load the corresponding program file and execute the corresponding method.

5. Through the controller's plugin mechanism, Zend_Controller_Action_ViewRenderer creates a view attribute for the controller's object class. This view is a Zend_View object. It is also responsible for rendering the corresponding template file render to the http response object after the controller action request is processed. Finally, the content of the response object is output to the browser by the Front Controller.

6. in step 5, although the template file is located by the ViewRender assistant object, it is executed by a member function of Zend_VIew (include this template file ), therefore, all attributes and member functions of the view object in the Controller attributes can be used in the template file.

 

The lifecycle of an http request ends and the browser obtains the content. When the controller action specifies the variable to be presented to the view, it usually interacts with the database through Zend_Db_Table to obtain data.

Interactive Data Processing with databases is called business logic. The template file also contains simple loop logic, which is called display logic.

In MVC implementation, Model is responsible for processing business logic, View is responsible for processing display logic, and Controller is responsible for coordinating these two parts, so that the Controller code should be as concise as possible, it only exists as an agent.

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.