php backend specification

Controller naming convention
1, the first letter is capitalized, the rest are lowercase
2, corresponding to the database name. Do not underscore
3, method name camel case. The first letter is lowercase
4, the general method name add, edit, detail, lists

Program flow
1: Verification parameter
2: Formatting parameter
3: Simple storage, modification and query to directly call db
4: Multiplexing, complex logic. Be sure to write model
5: Do not write model for query. Unless a lot of reuse Place
6: involves image processing. Note that the underlying image processing class should be called

Model naming convention
1, capitalized first letter, camel case
2, corresponding to database name
3, common method name add, edit, detail, lists
4, the granularity of the method should be appropriate. It cannot be large and complete, nor can it be too small to cause multiple queries of data

Program flow
1: The parameters should be as the name implies
2: Try to consider extension and general use
3: If permission is involved, be sure to verify. Prevent ultra vires
4: Unified error handling
5: Unified failure returns false

Naming principles:
1, short, commonly used words
2, the meaning of the class name has been expressed, the method name should not be repeated For
example:
add a user under the User class. Name it: add but not addUser
3, keywords, you can add s to avoid open keyword

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325131373&siteId=291194637