PHP中的文档是否有标准样式?

jwh*_*ock 25 php documentation

我是PHP开发的新手,我想知道社区是否有任何关于使用注释的代码内联文档的指南.我喜欢像Python的PEP 257这样的东西,但我会选择一种流行的文档提取工具使用的格式,甚至是流行产品的文档标准.

Dan*_*erg 11

PHP最广泛使用的API文档形式是phpDocumentor aka phpdoc.相当多的IDE也能够使用phpDocumentor样式API文档提取信息以改进自动完成提示.


Pau*_*jan 6

使用phpdoc(非常类似于javadoc)


jor*_*ens 6

首先想到的是 PHPdoc,看看http://www.phpdoc.org/


Per*_*son 6

phpdoc (phpDocumentor) 样式很常见。它使用包含 DocBlocks 的 DocComments

<?php
/**
 * This is a DocBlock for a function.
 */
function associatedFunction()
{
}

<?php
/**
 * I belong to a file
 */

/**
 * I belong to a class
 */
class Def
{
}
Run Code Online (Sandbox Code Playgroud)

标签和注释:

 <?php
 /**
  * A summary informing the user what the associated element does.
  *
  * A *description*, that can span multiple lines, to go _in-depth_ into the details of this element
  * and to provide some background information or textual references.
  *
  * @param string $myArgument With a *description* of this argument, these may also
  *    span multiple lines.
  *
  * @return void
  */
  function myFunction($myArgument)
  {
  }
Run Code Online (Sandbox Code Playgroud)

来源