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
Reply content:
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

PHPsessionscanstorestrings,numbers,arrays,andobjects.1.Strings:textdatalikeusernames.2.Numbers:integersorfloatsforcounters.3.Arrays:listslikeshoppingcarts.4.Objects:complexstructuresthatareserialized.

TostartaPHPsession,usesession_start()atthescript'sbeginning.1)Placeitbeforeanyoutputtosetthesessioncookie.2)Usesessionsforuserdatalikeloginstatusorshoppingcarts.3)RegeneratesessionIDstopreventfixationattacks.4)Considerusingadatabaseforsessionstoragei

Session regeneration refers to generating a new session ID and invalidating the old ID when the user performs sensitive operations in case of session fixed attacks. The implementation steps include: 1. Detect sensitive operations, 2. Generate new session ID, 3. Destroy old session ID, 4. Update user-side session information.

PHP sessions have a significant impact on application performance. Optimization methods include: 1. Use a database to store session data to improve response speed; 2. Reduce the use of session data and only store necessary information; 3. Use a non-blocking session processor to improve concurrency capabilities; 4. Adjust the session expiration time to balance user experience and server burden; 5. Use persistent sessions to reduce the number of data read and write times.

PHPsessionsareserver-side,whilecookiesareclient-side.1)Sessionsstoredataontheserver,aremoresecure,andhandlelargerdata.2)Cookiesstoredataontheclient,arelesssecure,andlimitedinsize.Usesessionsforsensitivedataandcookiesfornon-sensitive,client-sidedata.

PHPidentifiesauser'ssessionusingsessioncookiesandsessionIDs.1)Whensession_start()iscalled,PHPgeneratesauniquesessionIDstoredinacookienamedPHPSESSIDontheuser'sbrowser.2)ThisIDallowsPHPtoretrievesessiondatafromtheserver.

The security of PHP sessions can be achieved through the following measures: 1. Use session_regenerate_id() to regenerate the session ID when the user logs in or is an important operation. 2. Encrypt the transmission session ID through the HTTPS protocol. 3. Use session_save_path() to specify the secure directory to store session data and set permissions correctly.

PHPsessionfilesarestoredinthedirectoryspecifiedbysession.save_path,typically/tmponUnix-likesystemsorC:\Windows\TemponWindows.Tocustomizethis:1)Usesession_save_path()tosetacustomdirectory,ensuringit'swritable;2)Verifythecustomdirectoryexistsandiswrita


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Zend Studio 13.0.1
Powerful PHP integrated development environment

SublimeText3 Linux new version
SublimeText3 Linux latest version

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment
