Program logic structure in PHP project development
For PHP project development, try to adopt OOP ideas for development. Especially after PHP5, the object-oriented development function has been greatly improved.
In PHP projects, we recommend that independent functional modules be written as function calls as much as possible, corresponding to a whole piece of business logic. We recommend encapsulating them into classes, which can not only improve code readability, but also improve code reusability. For example, we usually encapsulate the database interface into a database class, which is conducive to platform transplantation.
Duplicated codes should be made into public libraries. (Except for what we encountered with plug-in products, this product series has multiple similar products. In order to reduce the size of the installation package as much as possible, it is not suitable to make all the functions shared by these products into a public library)