PHP layering mode

Source: Internet
Author: User
PHP layered Mode



This text, written on May 1, at that time for some purposes, learned PHP, on the T-line developed a bit.

about layering mode, the first to learn C #, in touch with the three-tier architecture, MVCinJava , and the multi-layered architecture ofJava , there were Model1,model2before MVC . Today I want to write php, want to follow the path in Java , although all claim to object-oriented language, but the way is still different.

The core idea of layering should be decoupling and each level.

Multi-tiered architecture in Java:

Data persistence layer:DAO(data?access?object) or also defines a Idao interface; Data Access objects have no business logic, and CRUD for each table or entity . Frames are,dbutils (not on frames, toolkits),hibernate,ibatis->myibatis , etc.

Model layer, there are people called entity entities also called Beans, although it can be a bean, the individual thinks the Bean concept is not accurate, theBean concept is broader. This layer runs through the entire system, andDAO transfers the table data to the model object. With the model carries data transfer. This layer is intended to be object oriented.

Service layer, Business Logic layer: Responsible for system logic, control transactions, etc.; Call DAO to complete data persistence. Among them Web?service,cxf,Hessian is related to this layer of technology.

The web layer, which shows the data interacting with the user, can be performed by the servlet,JSP(also compiled into servelt afterjsp ) , using struts The web layer can divide the Action layer, distribute the user request to invoke Service layer logic, distribute the processing result data to the JSP,servlet.

In PHP, the view layer has a template to act as the core principle of the template is the substitution character. One months later, this PHP is as hard to talk as C #. But I can still read the PHP code.


  • 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.