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

The installation of PHPDocument and the method of code specification annotation

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly explains "the installation of PHPDocument and the method of code specification annotation". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "the installation of PHPDocument and the method of code specification annotation".

1. Install phpDocumentor (command line installation is not recommended)

Download the latest version of PhpDoc at http://manual.phpdoc.org/

Put it in the web server directory so that it can be accessed through the browser

Click the files button to select the php file or folder you want to process

You can also ignore the processing of some files by specifying the Files to ignore under the interface.

Then click the output button to select the storage path and format of the generated document.

Finally, click create,phpdocumentor and the document will be generated automatically.

2. How to write PHP specification notes

All document tags begin with @ after the * of each line. If the @ tag comes out in the middle of a paragraph, the tag will be ignored as normal content.

@ access this tag is used to indicate the access permissions for keywords: private, public or proteced scope of use: class,function,var,define,module

@ author indicates the author

@ copyright indicates copyright information

@ const usage range: define is used to indicate the constant of define in php

@ final scope of use: class,function,var indicates that the keyword is a final class, method, and property, which forbids derivation or modification.

@ global indicates the global variable referenced in this function

@ name specifies an alias for the keyword.

@ package is used to logically group one or more keywords.

@ abstrcut indicates that the current class is an abstract class

@ param specifies the parameters of a function

@ return indicates the return value of a method or function

@ static indicates that the Guanjian word is static.

@ var indicates the variable type

@ version indicates version information

@ todo indicates areas that should be improved or not implemented

@ link can refer to any keyword in the document through link

@ ingore is used to ignore specified keywords in the document

Some annotation specifications

a. Comments must be

/ * *

* XXXXXXX

, /

The form of

b. For functions that reference global variables, you must use the glboal tag.

c. For variables, you must mark their type (int,string,bool...) with var

d. The function must indicate its parameters and return value through the param and return tags

e. For keywords that appear two or more times, ignore the excess through ingore and keep only one.

f. Where other functions or classes are called, use link or other tags to link to the appropriate section to facilitate the reading of the document.

g. Use non-documentary comments (comments before keywords that PHPDOC does not recognize) where necessary to improve the readability of the code.

h. Keep the descriptive content as concise as possible and use phrases instead of sentences as much as possible.

i. Global variables, static variables and constants must be specified with the corresponding tags

Keywords that can be recognized by phpdoc:

Include

Require

Include_once

Require_once

Define

Function

Global

Class

3. Php code for specification comments:

At this point, I believe that you have a deeper understanding of "the installation of PHPDocument and the method of code specification annotation". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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