One of the reasons you like PHP is that she has countless open-source programs, phpxref. comhomecode-library, and a lot of excellent code for you to read in detail! The method to analyze the source code is just like it is needed to come to a new place! How to analyze a PHP open source... one of the reasons for like PHP is that she has countless open source program http://phpxref.com/home/code-library, a lot of good code for you to read carefully in your hands!
The method to analyze the source code is just like it is needed to come to a new place!
Example: how to analyze a PHP open-source program? How can we get more knowledge in the code?
Reply content:
One of the reasons I like PHP is that she has countless open source program http://phpxref.com/home/code-library, a lot of good code for you to read in detail!
The method to analyze the source code is just like it is needed to come to a new place!
Example: how to analyze a PHP open-source program? How can we get more knowledge in the code?
On the same floor, I will run the program first, then find the functions that I am interested in, and try to modify the file while viewing the page that implements the functions to achieve the desired effect. Through multiple modifications (in fact, this process is to read and analyze the Code), you can understand the meaning of each change.
I have summarized some of the methods here ;-)
Rough Analysis:
1. Functional Analysis on software usage-a greater understanding of the business logic of the program;
2. directory structure-analyze the meaning of each folder and file;
3. database structure-the purpose of a program is to analyze the logic design of the database for data. Specifically, the design of each field gives a good understanding of the program!
4. Design Pattern-there is a saying like this when studying the design pattern.Add all PHP files to the same file, and the program still works.
5. Code Analysis-starting from the initial request of the page, simulate the PHP parser to view the code, and perform a preliminary analysis of the code from the business logic;
Program Design Analysis:
1. template system analysis, if any
2. cache mechanism analysis, if any
3. Plug-in mechanism, if any
4. Scalability Analysis
5. Security Mechanism Analysis
6. Study the source code optimization on access pressure, execution efficiency, system efficiency, and database query ..
I am used to finding the entrance first and then figuring out the general process. I will look at the details later.
I usually run the program first, and then modify the code to see what changes will happen.
I don't know how to program, but if I read a copy of the source code. First, read the official documentation to understand the file layout, syntax specifications, program structure, and database structure. Then, read the implementation process of each function in different layers.
From the page entry, I will first get a general idea of the composition of the content displayed on a page, and then continue to roll back to the corresponding file based on the function for reading. After reading the content of a page, I learned about the use of some of the more common functions in the code package and the file structure of the code package. On the basis of this file structure, analyze its internal object structure, and read the object class library from the bottom up according to the inheritance relationship.