PHP标准注释列表

@api

  • 语法要求
  • 官方示例如下:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    /**
    * This method will not change until a major release.
    *
    * @api
    *
    * @return void
    */
    function showVersion()
    {
    <...>
    }

@author

  • 语法要求

    • @author [name] []
  • 官方示例如下:

1
2
3
4
/**
* @author My Name
* @author My Name <my.name@example.com>
*/

@category

  • 语法要求
    • @category [description]
  • 官方示例
1
2
3
4
5
6
/**
* Page-Level DocBlock
*
* @category MyCategory
* @package MyPackage
*/

@copyright

  • 语法要求
    • @copyright [description]
  • 描述
    • 此注释专用于对软件版权进行注释
  • 官方示例
    1
    2
    3
    /**
    * @copyright 1997-2005 The PHP Group
    */

@deprecated

  • 语法要求

    • @deprecated [version] [description]
  • 官方示例

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    /**
    * @deprecated
    * @deprecated 1.0.0
    * @deprecated No longer used by internal code and not recommended.
    * @deprecated 1.0.0 No longer used by internal code and not recommended.
    */
    function count()
    {
    <...>
    }

@example

  • 语法要求

    • @example [location] [start-line] [number-of-lines] ] [description]
  • 官方示例

    1
    2
    3
    4
    5
    6
    7
    8
    9
    /**
    * @example example1.php Counting in action.
    * @example http://example.com/example2.phps Counting in action by a 3rd party.
    * @example "My Own Example.php" My counting.
    */
    function count()
    {
    <...>
    }

@filesource

@filesource标签用于告诉phpDocumentor将当前文件的源包含在解析结果中。

  • 语法要求
    • @filesource
  • 说明
    @filesource标签告诉phpDocumentor将当前文件包含在解析输出中。由于这仅适用于整个文件的源代码,所以必须在文件级PHPDoc中使用此标记。任何其他位置都将被忽略。

当包含此标签时,phpDocumentor将压缩文件内容并使用Base64进行编码,以便可以由变压器处理。任何能够显示源代码的模板都可以在抽象语法树中读取相关文件元素中的源子元素。

  • 官方示例
1
2
3
/ **
* @filesource
* /

@global

@global标签用于通知phpDocumentor全局变量_or_其用法。(非必须)

  • 语法要求
    • @global [ Type ] [name] @global [ Type ] [description]

@ignore

@ignore标签用于告诉phpDocumentor结构元素不被phpDocumentor处理。

  • 语法要求
    • @ignore []
  • 官方示例
1
2
3
4
5
6
7
8
9
10
11
if($ ostest){
/ **
*这个定义将是“Unix”或“Windows”
* /
define(“OS”,“Unix”);
} else {
/ **
* @ignore
* /
define(“OS”,“Windows”);
}

@api

  • 语法要求
  • 官方示例

@api

  • 语法要求
  • 官方示例

@api

  • 语法要求
  • 官方示例

@api

  • 语法要求
  • 官方示例

@api

  • 语法要求
  • 官方示例

@api

  • 语法要求
  • 官方示例

@api


@api


@api