Home > Article > Backend Development > How to quickly start a ThinkPHP project
The subject of the question is an intern and currently works in a company doing backend maintenance and secondary development.
The company's backend and order system are all developed using ThinkPHP, and there are many things.
I don’t know how to start to figure out the architecture of this system. The database is also quite messy (it is ThinkPHP after all)
Currently, I have written a small script based on PHP’s reflection class, which can count the current modules with one click. All controller methods (including protected methods).
Should I continue to analyze controllers one by one, or should I click on the website and start the analysis from the process?
Or are there other better analysis ideas?
I hope seniors can give me some advice
The subject is an intern and currently works in a company doing backend maintenance and secondary development.
The company's backend and order system are all developed using ThinkPHP, and there are many things.
I don’t know how to start to figure out the architecture of this system. The database is also quite messy (it is ThinkPHP after all)
Currently, I have written a small script based on PHP’s reflection class, which can count the current modules with one click. All controller methods (including protected methods).
Should I continue to analyze controllers one by one, or should I click on the website and start the analysis from the process?
Or are there other better analysis ideas?
I hope seniors can give me some advice
Start by analyzing the file, which businesses are which page controllers mainly use which tables.
It is not necessary to read all the files and all methods at the beginning, and it is impossible to understand them.
I think so, first learn to imitate those simple businesses and tables, that is, simple additions, deletions, modifications and searches.
The next step is to study the encapsulated things, how to call them, what business is handled, and which tables are used.
Look for answers with your needs or questions, otherwise such a beautiful winter afternoon would pass by in a daze while dozing off.
Not all methods in the class are useful.
In addition, clarify your own goals, be familiar with the company's business, or understand the TP framework itself.
Process analysis begins
Enable xdebug
, select the function you want to know, click and follow step by step. It is also best to know what each table and field does. It is less efficient to ask your colleagues to mess around on your own.
No need to analyze, just take a rough look. If there are specific needs, then analyze them. Or if you think something is not implemented well, write your own code to replace it. That’s it
It may be faster to get familiar with it based on the business process. Take a rough look at the code. Then take a look at the process. You don’t need to read it in detail. When you need to use it, dig deeper
It is recommended that the poster divides the process into two parts
1. Understand the basic syntax and usage of the TP framework based on the existing TP version
2. Ask the old employees for some business-related things, such as which module the project is responsible for, and then go through the program according to the business process In this way, when a problem is discovered, it can be quickly located without having to find it all at once
What I want to ask is, are there any documents handed over to you? When taking over a project, it is best to follow the document and execute a rough idea of the implementation idea, and then find the corresponding code analysis and process analysis. Once you are familiar with the system, you will also be familiar with the TP.
1. Familiar with business processes
2. Read through the ThinkPHP manual
1. Familiar with system business processes
2. Familiar with thinkphp
3. Familiar with php
First analyze the project requirements and be proficient in the task process
There is also the question of whether it is a framework. The framework only helps you speed up development. The main body is still php and mysql.
The relationship between the tables has nothing to do with whether it is TP.
Or organize the table structure first