• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

PhpDocumentor手册-安装和标签使用

php 搞代码 4年前 (2022-01-23) 19次浏览 已收录 0个评论
文章目录[隐藏]

PhpDocumentor手册-安装和标签使用

1.安装

必须包含:php 5.3.3版本以上, intl for php 扩展 ,Graphviz

安装方式 使用 pear 命令

pear channel-discover pear.phpdoc.org

pear install phpdoc/phpDocumentor

2.DocBlock基本语法

DocBlock(文档块)

/**

* phpdocumentor 测试.

*

*/

DocBlock使用范围在以下结构元素中

l namespace

l require(_once)

l include(_once)

l class

l interface

l trait

l function (including methods)

l property

l constant

l variables, both local and global scope.

DocBlock例子

/**

* 摘要:实现得到用户年龄的方法。

*@param string $name 用户名称,需使用中文

*@return

*/

Function getage($name){

……

}

DocBlock包括三个部分

1.摘要

对整个功能的概要说明

2.说明

对功能或者标记扩展说明

算法说明

示例说明

版权许可说明…

对标记 的说明

3.标记

@api

@author

@category

@copyright

@deprecated

@example

@filesource

@global

@ignore

@internal

@license

@link

@method

@package

@param

@property

@property-read

@property-write

@return

@see

@since

@source

@subpackage

@throws

@todo

@uses & @used-by

@var

@version

3.标签的使用

Type:string , int, bool, floot , array, void 等等

详见 http://phpdoc.org/docs/latest/references/phpdoc/types.html

@api 标记该结构元素适合第三方的部件

@author 文档作者标记

使用语法

@author [name] []

@package 封装包的名称 一组相关类、函数封装的包名称

使用语法

@package [level 1]\[level 2]\[etc.]

@copyright 版权信息

使用语法

@copyright [description]

@deprecated 弃用说明

使用语法

@deprecated [] []

@example 示例代码的位置

使用语法

@example [location] [ [] ][]

@example /www/web/default/test.php 1 3 代码在test.php文件中从第一行到第三行

@ignore 告诉phpdocumentor忽略处理的

使用语法

@ignore []

@ignore phpdoc会忽略OS 常量的定义,不在文档中显示

define(“OS”,”Windows”);

@license 许可说明

使用语法

@license [] [name]

@link 链接外部更详细的信息

使用语法

@link [URI] []

@method 简单理解 表示 __call 魔法函数是 需要调用的方法

使用语法

@method [return type] [name]([[type] [parameter]])[]

@method void setInteger(integer $integer) 设定整数

@param 一个函数或者方法的参数

使用语法

@param [Type] [name] []

@param string $myArgument 我的一个字符串参数

@property 表示使用 __get()和__set()魔术方法 调用的属性

使用语法

@property [Type] [name] %本文@来源gao@!dai!ma.com搞$$代^@码!网搞代gaodaima码[]

@return 方法或函数的返回值

使用语法

@return [Type] []

@see 查看相关联的结构元素或者网站

使用语法

@see [URI | FQSEN] []

@see \Phpdocumentor::$items 查看phpdocumentor类下的items属性

FQSEN解释:结构元素名称\My\Space\MyClass::myMethod()

@since 从哪个版本是开始使用

@since [version] []

@source 显示源代码

@source [ [] ][]

@throws 抛出错误说明

@throws [Type] []

@todo 后续有待开发的描述

@uses & @used-by 查看参考相关结构元素

@uses [FQSEN] []

@var 变量或者属性

@var [“Type”] [$element_name][]


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:PhpDocumentor手册-安装和标签使用

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址