Home > Article > Backend Development > Let’s talk about the traditional three-tier architecture in PHP
What is the three-tier architecture
The so-called three-tier development is to divide the entire business application of the system into the presentation layer-the business logic layer-the data Access layer, which facilitates system development, maintenance, deployment and expansion.
Layering is to achieve "high cohesion and low coupling". Adopt the idea of "divide and conquer" to divide the problem into individual solutions, which is easy to control, easy to extend, and easy to allocate resources.
Presentation layer: Responsible for interacting directly with users, generally refers to the system interface, used for data entry, data display, etc. This means that only work related to appearance display is done, and work that does not belong to him does not need to be done.
Business logic layer: Used to do some validity verification work to better ensure the robustness of program operation.
Such as completing data addition, modification and query services;
It is not allowed to enter empty strings in the specified text box, whether the data format is correct and data type verification;
Judgment of the legality of the user's permissions, etc., through many of the above judgments to decide whether to continue to pass the operation backward, and try to ensure the normal operation of the program.
Data Access Layer: As the name suggests, it is used to specifically interact with the database. Perform data addition, deletion, modification and display, etc.
It should be emphasized that all data objects are only referenced in this layer, such as System.Data.SqlClient, etc. Such references should not appear anywhere except the data layer.
Thank you everyone for reading, I hope you will benefit a lot.
Recommended tutorial: "php tutorial"
The above is the detailed content of Let’s talk about the traditional three-tier architecture in PHP. For more information, please follow other related articles on the PHP Chinese website!