什么是phpDocumentor
更新時(shí)間:2008年09月25日 09:17:35 作者:
PHPDocumentor是一個(gè)用PHP寫的工具,對(duì)于有規(guī)范注釋的php程序,它能夠快速生成具有相互參照,索引等功能的API文檔。
7. 總結(jié)
phpDocumentor是一個(gè)非常強(qiáng)大的文檔自動(dòng)生成工具,利用它可以幫助我們編寫規(guī)范的注釋,生成易于理解,結(jié)構(gòu)清晰的文檔,對(duì)我們的代碼升級(jí),維護(hù),移交等都有非常大的幫助。
關(guān)于phpDocumentor更為詳細(xì)的說(shuō)明,可以到它的官方網(wǎng)站
http://manual.phpdoc.org/查閱
8.附錄
附錄1:
能夠被phpdoc識(shí)別的關(guān)鍵字:
Include
Require
include_once
require_once
define
function
global
class
附錄2
文檔中可以使用的標(biāo)簽
<b>
<code>
<br>
<kdb>
<li>
<pre>
<ul>
<samp>
<var>
附錄三:
一段含有規(guī)范注釋的php代碼
<?php
/**
* Sample File 2, phpDocumentor Quickstart
*
* This file demonstrates the rich information that can be included in
* in-code documentation through DocBlocks and tags.
* @author Greg Beaver <cellog@php.net>
* @version 1.0
* @package sample
*/
// sample file #1
/**
* Dummy include value, to demonstrate the parsing power of phpDocumentor
*/
include_once 'sample3.php';
/**
* Special global variable declaration DocBlock
* @global integer $GLOBALS['_myvar']
* @name $_myvar
*/
$GLOBALS['_myvar'] = 6;
/**
* Constants
*/
/**
* first constant
*/
define('testing', 6);
/**
* second constant
*/
define('anotherconstant', strlen('hello'));
/**
* A sample function docblock
* @global string document the fact that this function uses $_myvar
* @staticvar integer $staticvar this is actually what is returned
* @param string $param1 name to declare
* @param string $param2 value of the name
* @return integer
*/
function firstFunc($param1, $param2 = 'optional')
{
static $staticvar = 7;
global $_myvar;
return $staticvar;
}
/**
* The first example class, this is in the same package as the
* procedural stuff in the start of the file
* @package sample
* @subpackage classes
*/
class myclass {
/**
* A sample private variable, this can be hidden with the --parseprivate
* option
* @access private
* @var integer|string
*/
var $firstvar = 6;
/**
* @link http://www.example.com Example link
* @see myclass()
* @uses testing, anotherconstant
* @var array
*/
var $secondvar =
array(
'stuff' =>
array(
6,
17,
'armadillo'
),
testing => anotherconstant
);
/**
* Constructor sets up {@link $firstvar}
*/
function myclass()
{
$this->firstvar = 7;
}
/**
* Return a thingie based on $paramie
* @param boolean $paramie
* @return integer|babyclass
*/
function parentfunc($paramie)
{
if ($paramie) {
return 6;
} else {
return new babyclass;
}
}
}
/**
* @package sample1
*/
class babyclass extends myclass {
/**
* The answer to Life, the Universe and Everything
* @var integer
*/
var $secondvar = 42;
/**
* Configuration values
* @var array
*/
var $thirdvar;
/**
* Calls parent constructor, then increments {@link $firstvar}
*/
function babyclass()
{
parent::myclass();
$this->firstvar++;
}
/**
* This always returns a myclass
* @param ignored $paramie
* @return myclass
*/
function parentfunc($paramie)
{
return new myclass;
}
}
?>
相關(guān)文章
PHP程序員面試 切忌急功近利(更需要注重以后的發(fā)展)
招聘一個(gè)程序員,唯一對(duì)你有意義的是他能寫出好程序的能力。 很少人像這樣去招人,他們更喜歡去挑剔程序員的個(gè)人癖好和性格缺點(diǎn)。2010-09-09