As a half-bottle phper, source code enthusiasts have encountered many problems during the development process, and do not pay attention to code specifications during the development process, if you have encountered many difficulties, search for the suggestions provided by php experts here.
As a half-bottle phper, source code enthusiasts have encountered many problems during the development process, and do not pay attention to code specifications during the development process, if you have encountered many difficulties, search for the suggestions provided by php experts here. suggestions provided by php experts:
1. when using select to query information from the same database, use a join statement to get all the information you need in a neat manner at a time, instead of writing multiple mysql_query/while/mysql_fetch_array statements.
2. if you call a database connection in multiple files, create a connection. php file to save your connection variables and include the file as needed.
3. for small projects, write all your functions in a file. for large projects, write them in an object and include the file where necessary.
4. if your included files are out of control, you can create an include file that contains all. inc files and include this include file as needed.
5. compile a document for your code. you will need it when you read the code three months later.
6. code formatting is nothing more important than readability.
7. separate the logic and presentation layers.
8. when writing a class, make sure you know when is the best time for coupling and when is the best time for expansion.
9. the interface is your friend.
10. as projects become larger and larger, splitting your code into models, views, and controllers is a super scam.
11. never output POST and GET data before the HTML tag is removed,
12. never trust user input, even if she is your mother.
13. never repeat the class name. Remember, always!