File structure
|――images
|――include
|――parameter
|――config
|――function
|――index
Images storage image files, include is the system is to refer to the file, generally in the parameter stored in the parameter file, config in the configuration file, function stored method files, such as JavaScript method, and according to the classification of functional modules, Put the classes of each function into it
Filename
Folder naming is generally used in English, the length is generally not more than 20 characters, named in lowercase letters. In addition to special cases to use Chinese pinyin, some common folder naming such as: Images (storage graphics file), Flash (store flash files), style (store css file), scripts (store JavaScript script), Inc. ( Store include files), link (store links), media (storing multimedia files), etc. File names are combined in lowercase letters, numbers, and underscores.
Block annotations
Block annotations are typically used to provide descriptions of files, methods, data structures, and algorithms. Block annotations are placed at the beginning of each file and before each method. They can also be used elsewhere, such as within a method. Block annotations inside features and methods should have the same indentation format as the code they describe.
The top of the block comment should have a blank line that separates the block annotations from the code, such as:
/*
* Here is a block comment
*/
Block annotations can start with/*-so that indent (1) can recognize it as the beginning of a block of code, without having to rearrange it.
/*-
* If you want to be ignored, use special-format block annotations
*
* One
* Both
* Three
*/
Note: If you do not use indent (1), you do not have to use/*-in your code or make concessions for others that might run indent (1) on your code.
Single-line Comment
Short annotations can be displayed in a single line and have the same indentation level as the code behind them. If a comment cannot be written in one line, it should take a block comment. There should be a blank line before a single-line comment. Here is an example of a single line comment in the code:
if (condition) {
/* The following code runs the condition */
...
}
end note
Very short annotations can be on the same line as the code they are describing, but there should be enough whitespace to separate the code and comments. If more than one short note appears in a large segment of code, they should have the same indentation.
The following is an example of an end note in a code:
Copy CodeThe code is as follows:
if ($a = = 2) {
return TRUE; /* Description of the single condition */
} else {
return IsPrime ($a); /* The rest of the conditions */
}
End of line Comment
The comment qualifier "//" can comment out a whole line or part of a line. It is generally not used for consecutive lines of comment text, however, it can be used to comment out a contiguous number of lines of code snippets. Here are some examples of all three styles:
Copy CodeThe code is as follows:
if ($foo > 1) {
The second usage.
...
}
else {
return false; Explain the reason for the return value
}
if ($bar > 1) {
//
The third way to use
...
//}
else {
return false;
//}
Document comments
Document comments describe PHP classes, constructors, methods, and fields (field). Each document comment is placed in the comment delimiter/**...*/, and a comment corresponds to a class or member. The comment should precede the declaration:
/**
* Description of some of this class ...
*/
Class Example {...
Note that the top-level (top-level) class is not indented, and its members are indented. The first line (/**) of the document comment describing the class does not need to be indented, and subsequent document comments indent each line by 1 cells (the asterisk is aligned vertically). Members, including constructors, indent the first line of their document comments by 4, and each line is then indented by 5 cells.
If you want to give information about a class, variable, or method that is not suitable for writing in a document, you can use implementation block annotations (see 5.1.1) or a single-line comment immediately following the declaration (see 5.1.2). For example, the details of a class implementation should be placed in the implementation block comments immediately following the class declaration, rather than in the document comments.
Document comments cannot be placed in a definition block of a method or constructor, because the program will associate the first declaration that is located after the document comment.
http://www.bkjia.com/PHPjc/322068.html www.bkjia.com true http://www.bkjia.com/PHPjc/322068.html techarticle file Structure |――images |――include |――parameter |――config |――function |――index images store picture files, include is the system is to refer to the file, generally in ...