phpdoc的语法规则DocBlock

1 篇文章 0 订阅
一个简单的实例
/**
  * 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

用来标记结构元素适合第三方使用

@author 用来标记作者
@category 用来标记组织
@copyright 标记版权
@deprecated 已经启用,不建议使用
@filesoure 整个文件的源
@ignore 忽视不处理
@license 许可证的标签
@link 定义链接
@throws 抛出的错误类型
@todo 计划做的内容
@var 标记属性
@version 版本信息
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值