File names: all are in lower case, and the names of classes are separated by the following line: use the method name in the upper case of the first letter to name the method name in the class: use the lower case of the first letter to name the private method and private variables in the class: the name of the function (variable name) starts with an underscore (_): all lowercase letters. the words are separated by an underscore... file names: All files must be in lower case and separated by hyphens
Class name: uses the upper-case camper name.
Method name in the class: the method is named in the lower case of the first letter.
Private methods and private variables in the class: start with an underscore
Function name (variable name): all lowercase letters separated by the following line
The following details
All the hosts files are suffixed with. class. php. They are named by the camper method and capitalized, for example, Pay. class. php;
The category class name and the Directory _ file name are consistent. For example, the Directory of the class name Zend_Autoloader is Zend/Autoloader. class. php;
The alias function uses lowercase letters and underscores. Example: get_client_ip;
The upper method uses the hump method, and the first letter is lowercase or the underline "_", for example, listComment (), _ getResource (). Generally, the method starting with an underscore is a private method;
The name of the Marker attribute uses the hump method. The first letter is lowercase or the underline "_", for example, $ username, $ _ instance. generally, attributes starting with an underscore are private attributes;
A constant named after an uppercase letter and an underscore "_", for example, "HOME_URL ";
Take a look:
1. indent and line length
Indent four spaces instead of tabs (some editors can configure a tab to represent multiple spaces, note that it is a space). each line must be about-85 characters long.
2. Control Structure
This part is the easiest to ignore and is also the most important aspect that affects the beauty of the code. The example is very detailed and has benefited a lot. the code is as follows:
3. function call. the code is as follows:
4. class name specification, the code is as follows:
5. method name specification (hump name). The code is as follows:
6. the code for defining arrays is as follows:
'bar', 'spam' => 'ham',);?>
7. Notes
Http://pear.php.net/manual/en/standards.sample.php
Http://pear.php.net/manual/en/standards.header.php
8. Including Code
Use include_once or require_once at any time
Require_once 'foo. php ';