The structure of a monolithic framework is segmented, and a new understanding of the Include_path and object-oriented mechanisms is also obtained through the entry file.

Source: Internet
Author: User

1. The common approach to implementing the framework: MySQLdb, file uploads, image processing and verification codes, sessions, string processing, and so on, each framework needs to be handled in a coordinated manner.

2. A complete Project process: (1) Full host "Configure the path to the file, and implement the normal access of the virtual domain name" "This does not need to do" Mvcproject project (2) Extract framework The main project is divided into the framework (Common Code framework) and the specific business logic implementation (APP) "in the app directory to implement the MVC folder", "to place a common method in the framework" to implement the constants of these access paths on the configuration file settings, And the writing of the auto-load function that contains the file "clear this logic."

3. Platform Concept "Here is mainly between the front and back, but the PC platform and WAP platform display code is not the same framework, using the interface for data consistency" is for the PC platform, WAP platform and other projects to do compatibility issues. Data consistency between platforms "This is the key" and the foreground behind the scenes items are detached "The portal file displays the contents of the foreground folder and the Admin folder differently"

The "Focus" "ingress file handles different displays of rewrite processing requests and related items. This avoids the configuration processing of operations. "" So rewrite customization is more flexible "

"In the form of web2.0, background editing features. WAP terminal is the interface for the display of data. The frame of the PC and WAP display project is not consistent "

4. Segmentation of a project so far: (1) segmentation of public methods and business logic "framework and App" (2) split the foreground post code in the app project "All MVC Processing" (3) MVC segmentation of App two items (foreground background)

Such a partition in the import file for unified processing "pay more attention to the port file forwarding and path control" to complete a basic project of the General Division

5. Implementation of specific functions: "Implementation of the basic MVC-based structure for page logic processing" design and access validation of the Login database table "phpMyAdmin data processing by mysqli this extension" the "multi-directory class file automatically loaded" key: Through the Auto_ Load and include_path are used in combination with the controller and component projects that are used in the company are automatically loaded by default, except that the controller uses the base class to instantiate automatic loading, and the component is instantiated automatically when the controller needs access. The mechanism of automatic loading requires us to use a uniform naming convention so that the "management path in the project" key "path management using directory constants, declaration and management in the configuration file" is implemented. Windows supports two folder markers: So the backslash in the program can also execute normally (so all the programs use backslashes or predefined constants) path management in the template uses the template engine to send assign, and the path to implement the send basis in the public controller class. "Execution Process" focus: a deep understanding of the process of a URL access "" Because of this process, we make the logic function by invoking the module code in the access to a URL. This should be fully recognized. Unlike the multi-branched scenario in the process, such a feature is easy to handle (albeit with some impact on performance) "" Object-oriented is a way of organizing code, which should be recognized. Then the use of the object itself is to do the same for the code that already exists, to get to the logic to be implemented "

Understanding object-oriented is more profound in the framework, where execution is in index.php, because it is the inclusion of this file, and invoking other files to implement the business logic. "Object-oriented objects are designed to make it easy to point to locations in your code (so there are a lot of calling methods and restrictions), and in the code organization level, using inheritance, polymorphism, encapsulation is its feature"

"The above is the understanding of this framework"

"Include path problem" "Resolves path issues including file include: (In fact, PHP looks for files on disk processing mechanism)" "PHP for include processing mechanism, as long as the use of. And so on, the relative path is the path to execution of the code. In a real-world project, because all the code is processed against the index.php file, all the Include files have paths relative to the entry file. This is also the advantage of using the portal "" but when used in reality, the absolute path "" http://blog.csdn.net/oyd/article/details/2030293 "is used in the definition of constants. Include: The search for the included files is done in the relative include_path of the current working directory, followed by the include_path of the directory in which the current script is running (http://blog.csdn.net/ dyllove98/article/details/8635972) "

Substr the position of the string "negative numbers are matched from right to left" "PHP action String functions need attention"

"Object-oriented Cognition" "Object-oriented is actually a process of re-organization of modular coding, there is no change in the execution of the program, just a better way to organize and execute the code." So the instantiation and invocation of the object itself does not make much sense, it is equivalent to a variable. It is better to understand an object as an array. In this case, the objects in each of the initialized scripts will be created "" using object-oriented in the program will certainly consume performance, but we use this way to be too convenient for development speed and maintenance. That's why we use them: Design Patterns "

The structure of a monolithic framework is segmented, and a new understanding of the Include_path and object-oriented mechanisms is also obtained through the entry file.

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.