一个简单的实例
/**
* This is the summary for a DocBlock.
*
* This is the description for a DocBlock. This text may contain
* multiple lines and even some _markdown_.
*
* * Markdown style lists function too
* * Just try this out once
*
* The section after the description contains the tags; which provide
* structured meta-data concerning the given element.
*
* @author Mike van Riel <me@mikevanriel.com>
*
* @since 1.0
*
* @param int $example This is an example function/method parameter description.
* @param string $example2 This is a second example.
*/
@param和@return
可以输入的类型有
- string
- integer
- boolean or bool
- float or double
- object
- mixed
- array
- resource
- void
/**
* @param boolean $quiet when true 'Hello world' is echo-ed.
*
* @return void
*/
function outputHello($quiet)
{
if ($quiet) {
return;
}
echo 'Hello world';
}
注意多种类型可以用|分割**@return int| null**
@example
用来演示结构元素
@internal
和@api对应用来表示是内容的
@link
/**
* @link http://example.com/my/bar Documentation of Foo.
*
* @return integer Indicates the number of items.
*/
function count()
{
<...>
}
@api
用来标记结构元素适合第三方使用