PHP Documentation Tools PHP documentor Installation and usage _php tips

Source: Internet
Author: User
Tags documentation install php pear php source code

This article describes the PHP document tool PHP Documentor installation and use method. Share to everyone for your reference, specific as follows:

PHP Documentor is a module below pear that is used to generate documents. PHP documentor scan The specified directory under the PHP source code, scan the keyword, intercept the need to analyze the annotation, and then analyze the annotations of the special tag, generate HTML files, and then based on the analysis of the class and module information, build the corresponding index, generate HTML file. It's useful when review code.

First, install PHP documentor

First, make sure you have the Pear library installed,

; UNIX: "/path1:/path2" 
include_path = ".:/ Usr/share/pear "//pear library location 
; 
; Windows: "\path1;\path2" 
; include_path = ".; C:\php\includes " 

If Http://pear.php.net/go-pear is not installed, save the file as a second. Command line under PHP go-pear.php, you can install it. I was installed with Yum PHP, when installed, pear has been installed. When pear is installed, I can install phpdoc via pear install phpdocumentor.

[Apacheuser@krlcgcms01 ~]$ Phpdoc-h There will be a lot of parameters, to generate HTML documents, there are three parameters is enough.

-D directories to parse, multiple directories separated by commas
The storage path of the document generated by-t
Document format for-o output

Second, production documents

Copy Code code as follows:
[Root@krlcgcms01 test]# phpdoc-d "/tmp/test/mytest"-T "/tmp/test/doc"-O "HTML:frames:phpedit"

The above sentence is to say, will/tmp/test/mytest directory of PHP file, generate document material to put under/tmp/test/doc, document format HTML situation.

[apacheuser@krlcgcms01 doc]$ ls
blank.html elementindex.html li_首页.html
classtrees_default.html Elementindex_首页.html Media
classtrees_首页.html errors.html packages.html
default Index.html首页
elementindex_default.html li_default.html

To the directory where the generated documents are stored. The system is not loaded with Chinese characters, so it is garbled.

Take a look at index.html in the browser, and some of the content

PHP Documentor Documentation Tools

1. From the above figure, we can see that the contents of the document is mainly the PHP file in the annotation label listed, the corresponding file listed, looking more comfortable. Nothing else.

The comment labels are as follows :

@author Author Information
@const constants defined by define
@deprecate APIs not recommended for use
@global Global Variables
@package Package Information
@param function parameters
@return return value
@see Reference function
@since Introduction Time
@static Static variables
@var class member variable

2. The above image has garbled, the generated HTML edit is

Copy Code code as follows:
<meta http-equiv= ' content-type ' content= ' text/html; Charset=iso-8859-1 '/>

Change it to GBK will not show garbled.

I hope this article will help you with the PHP program design.

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.