Php coding specifications personal summary

Source: Internet
Author: User

1. Indicate the author and key algorithm computing processes at the head of the original ecological code or class.
For example
/**
* @ Author zengmoumou
* Function: obtains the operator, province, city, and county corresponding to the ip address based on the ip address list.
*/
2. Use a combination of English words as much as possible. The first is lowercase and the last is uppercase.
For example:
$ ConfTreeModel = D ("ConfTree ");
3. Use a combination of English words as much as possible for the function name. The first one is in lowercase and the last one is in uppercase.
For example:
Function searchRealServer ($ keyword)
4. It is best to write the author, variable, and algorithm of the function above the function.
For example:
/**
* @ Author zengmoumou
* Obtain the search result vswitch
* Enter description here...
* @ Param unknown_type $ allIds
*/
Private function getSwitchsInIds ($ allIds ){
5. The function should not exceed 100 rows. If the number is exceeded, split the function as needed.


6. independent functional Original Ecological Code is best divided into configuration pages, function pages, and business pages.
For example, a small development that reads the database for summary.
Can be divided
Config. php configuration page [write database configuration, etc]
Function. php function page [write various function-independent functions, such as reading data functions, constructing report functions, and sending email functions]
StatWeekData. php business page [reference the configuration page and function page, and call and process various function functions in turn to process the business logic]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.