您的位置:首页 > 编程语言 > PHP开发

【转载】windows下使用pear安装phpDocumentor

2013-12-09 10:50 543 查看
[环境]
OS: windows vista
我的php+apache+mysql是用appserv装的。apperv的安装后不需要配置就可以直接使用了,很方便。

[安装方法]
D:\AppServ\php5>go-pear.bat 
注:D:\AppServ\php5 是你的安php安装目录。
      安装最后会提示你点击执行:D:\AppServ\php5\PEAR_ENV.reg,你安装好注册信息。pear的安装就算完成了。

[测试]
D:\AppServ\php5>Pear install phpDocumentor
如果安装成功,那就o了。

[使用phpDocumentor]
D:\AppServ\php5>Phpdoc –h    
用来查看phpDoc的信息。

常用参数:
-f 要进行分析的文件名,多个文件用逗号分割
-d 要分析的目录,多个目录用逗号分割
-t 生成的文档的存放路径
-o 输出的文档格式,结构为输出格式:转换器名:模版目录,例如:HTML:frames:phpedit

使用例子:D:\AppServ\php5>Phpdoc -d "D:\AppServ\www\PhpDoc" -t "D:\AppServ\www\test_phpdoc" -o "HTML:frames:phpedit"
注:其中我指定的这个文件夹:D:\AppServ\www\PhpDoc是从phpDoc的主站上下载的可用web使用的phpDoc,可我搞了好久,也没搞搞它怎么用,这次用pear安装的phpDoc来解析phpDoc的代码,真可是自己解析自己,所以效果很明显。
当你打开查看D:\AppServ\www\test_phpdoc\index.html,你会感受会phpDoc功能出乎意料的强大,自动生成的文档很全面合理。

附:phpDoc的注释标准:
/**
* @name 名字
* @abstract 申明变量/类/方法
* @access 指明这个变量、类、函数/方法的存取权限
* @author 函数作者的名字和邮箱地址
* @category 组织packages
* @copyright 指明版权信息
* @const 指明常量
* @deprecate 指明不推荐或者是废弃的信息
* @example 示例
* @exclude 指明当前的注释将不进行分析,不出现在文挡中
* @final 指明这是一个最终的类、方法、属性,禁止派生、修改。
* @global 指明在此函数中引用的全局变量
* @include 指明包含的文件的信息
* @link 定义在线连接
* @module 定义归属的模块信息
* @modulegroup 定义归属的模块组
* @package 定义归属的包的信息
* @param 定义函数或者方法的参数信息
* @return 定义函数或者方法的返回信息
* @see 定义需要参考的函数、变量,并加入相应的超级连接。
* @since 指明该api函数或者方法是从哪个版本开始引入的
* @static 指明变量、类、函数是静态的。
* @throws 指明此函数可能抛出的错误异常,极其发生的情况
* @todo 指明应该改进或没有实现的地方
* @var 定义说明变量/属性。
* @version 定义版本信息
*/

附:pear 的安装过程序:

D:\AppServ\php5>go-pear.bat

Are you installing a system-wide PEAR or a local copy?
(system|local) [system] :

Below is a suggested file layout for your new PEAR installation.  To
change individual locations, type the number in front of the
directory.  Type 'all' to change all of them or simply press Enter to
accept these locations.

 1. Installation base ($prefix)        : D:\AppServ\php5
 2. Temporary directory for processing : D:\AppServ\php5\tmp
 3. Temporary directory for downloads  : D:\AppServ\php5\tmp
 4. Binaries directory                 : D:\AppServ\php5
 5. PHP code directory ($php_dir)      : D:\AppServ\php5\pear
 6. Documentation directory            : D:\AppServ\php5\pear\docs
 7. Data directory                     : D:\AppServ\php5\pear\data
 8. Tests directory                    : D:\AppServ\php5\pear\tests
 9. Name of configuration file         : C:\WINDOWS\pear.ini
10. Path to CLI php.exe                : D:\AppServ\php5\.

1-10, 'all' or Enter to continue: all
Installation base ($prefix) [D:\AppServ\php5] :
Temporary directory for processing [$prefix\tmp] :
Temporary directory for downloads [$prefix\tmp] :
Binaries directory [$prefix] :
PHP code directory ($php_dir) [$prefix\pear] :
Documentation directory [$php_dir\docs] :
Data directory [$php_dir\data] :
Tests directory [$php_dir\tests] :
Name of configuration file [C:\WINDOWS\pear.ini] :
Path to CLI php.exe [D:\AppServ\php5\.] :

Below is a suggested file layout for your new PEAR installation.  To
change individual locations, type the number in front of the
directory.  Type 'all' to change all of them or simply press Enter to
accept these locations.

 1. Installation base ($prefix)        : D:\AppServ\php5
 2. Temporary directory for processing : D:\AppServ\php5\tmp
 3. Temporary directory for downloads  : D:\AppServ\php5\tmp
 4. Binaries directory                 : D:\AppServ\php5
 5. PHP code directory ($php_dir)      : D:\AppServ\php5\pear
 6. Documentation directory            : D:\AppServ\php5\pear\docs
 7. Data directory                     : D:\AppServ\php5\pear\data
 8. Tests directory                    : D:\AppServ\php5\pear\tests
 9. Name of configuration file         : C:\WINDOWS\pear.ini
10. Path to CLI php.exe                : D:\AppServ\php5\.

1-10, 'all' or Enter to continue:
Beginning install...
Configuration written to C:\WINDOWS\pear.ini...
Initialized registry...
Preparing to install...
installing phar://go-pear.phar/PEAR/go-pear-tarballs/Archive_Tar-1.3.2.tar...
installing phar://go-pear.phar/PEAR/go-pear-tarballs/Console_Getopt-1.2.2.tar...

installing phar://go-pear.phar/PEAR/go-pear-tarballs/PEAR-1.5.4.tar...
installing phar://go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.0.2.tar.
..
pear/PEAR can optionally use package "pear/XML_RPC" (version >= 1.4.0)
install ok: channel://pear.php.net/Archive_Tar-1.3.2
install ok: channel://pear.php.net/Console_Getopt-1.2.2
install ok: channel://pear.php.net/Structures_Graph-1.0.2
install ok: channel://pear.php.net/PEAR-1.5.4
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)

PEAR: To install optional features use "pear install pear/PEAR#featurename"

******************************************************************************
WARNING!  The include_path defined in the currently used php.ini does not
contain the PEAR PHP directory you just specified:
<D:\AppServ\php5\pear>
If the specified directory is also not in the include_path used by
your scripts, you will have problems getting any PEAR packages working.

Would you like to alter php.ini <C:\WINDOWS\php.ini>? [Y/n] : y

php.ini <C:\WINDOWS\php.ini> include_path updated.

Current include path           : .;C:\php5\pear
Configured directory           : D:\AppServ\php5\pear
Currently used php.ini (guess) : C:\WINDOWS\php.ini
Press Enter to continue:

** WARNING! Old version found at D:\AppServ\php5, please remove it or be sure to
 use the new d:\appserv\php5\pear.bat command

The 'pear' command is now at your service at d:\appserv\php5\pear.bat

* WINDOWS ENVIRONMENT VARIABLES *
For convenience, a REG file is available under D:\AppServ\php5\PEAR_ENV.reg .
This file creates ENV variables for the current user.

Double-click this file to add it to the current user registry.

请按任意键继续. . .

D:\AppServ\php5>pear

安装完成
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: