Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the internal specifications of PHP development

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the relevant knowledge of "what are the internal specifications of PHP development". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

1. PHP considerations

1. The URL is separated by "-". (Implemented, some not implemented according to standards)

2. Method name adopts hump method. (Implemented, some not implemented according to standards)

3. Parameters must be separated by lowercase and underscore, humps or other formats are strictly prohibited, and the submitted parameters are consistent with the returned field names. (Implemented, some not implemented according to standards)

4, get data using GET, add, modify must POST. (Implemented, some not implemented according to standards)

API return format must call jsonResult base method. (Implemented)

6, error code must call ErrCode, can not directly write error code numbers. (Implemented)

7. Pagination uses the frame's own, self-built two-dimensional array must ['data' => $arr], pagination entries must use the limit parameter. (Implemented)

The interface returns comments (msg), which must be written in the config.msg file. (New)

The redis key must be written in the config.redis_key file. (Implemented, some not implemented according to standards)

10, composer installation new dependencies must be written in the doc/composer.txt file, and explain the purpose. (Implemented)

11. Add a timed task. The process must be written in the doc/crontab.txt file and explain the purpose. (Implemented)

Redis must have a set expiration time. Otherwise, save mysql and cache again (new)

13. Model name is consistent with table name (e.g. table q_user MODEL: QUser)

14. Request external network address, request duration must be set to 2s

Redis does not store long-term data, only for caching and temporary data storage (late transfer is very easy to cause data loss)

Second, mysql considerations

New table (responsible person: Liu Jun)

1. Character set utf8mb4 sorting specification utf8mb4_unicode_ci (implemented, some people do not implement according to the standard)

2. Database fields must be lowercase + underscore (implemented, some people do not implement according to the standard)

The new table field must have status,created_at,updated_at (association tables often miss three fields)

4. Status status must be 1 enabled, 0 disabled

5. Try not to use NULL

query

1. Query sql field must be added with table name (problems have occurred on the line)

2. It is strictly prohibited to use the * sign to inquire

SQL statements must be written as model, not in controller.

Update, insert, delete

1. Update, insert and delete multiple pieces of data. Non-log types must "adopt transactions"(ensure consistency).

Third, YAPI document precautions

1. The field description must be consistent with the product documentation (the front-end feedback check field is not clear)

2. Version directory needs to be added for iteration version interface (to prevent confusion)

3. Interface changes, interface documents must be updated synchronously

IV. Merger of branches

1. You must create a branch development as master, and bring your own name (origin/hotfix/huang/slowOpt)

2. Publish to master, you must first merge master to develop branch

3."Test branch" is prohibited from merging into "Development branch"

4."Pre-release branch" is prohibited from merging into "development branch"

"PHP development internal specifications what" content is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report