1. ʲôÊÇphpDocumentor ?
PHPDocumentorÊÇÒ»¸oÓÃPHPдµÄ¹¤¾ß£¬¶ÔÓÚÓйae¶×¢Ê͵Äphp³ÌÐo£¬ËuÄܹ»¿iËÙÉu³É¾ßÓÐÏa»¥²ÎÕÕ,Ë÷ÒýµÈ¹¦ÄܵÄAPIÎĵµ¡£Àϵİae±¾ÊÇ phpdoc£¬´Ó1.3.0¿ªÊ¼£¬¸uÃuΪphpDocumentor£¬Ðµİae±¾¼ÓÉÏÁ˶Ôphp5Ói¨µÄÖ§³Ö£¬Í¬Ê±£¬¿ÉÒÔͨ¹ýÔÚ¿Í»§¶Ëa¯ÀÀÆ÷ÉϲÙ×÷Éu³ÉÎĵµ£¬Îĵµ¿ÉÒÔת»»ÎªPDF,HTML,CHM¼¸ÖÖÐÎʽ£¬Ç³£µÄ½±a¡£
PHPDocumentor¹¤×÷ʱ£¬»aɨÃeÖ¸¶¨Ä¿Â¼ÏÂÃaeµÄphpÔ´´uÂe£¬É¨ÃeÆaÖеĹؼu×Ö£¬½ØÈ¡ÐeÒªÖÎoµÄ×¢ÊÍ£¬È»ºoÖÎo×¢ÊÍÖеÄרÓõÄtag£¬Éu³É xmlÎļþ£¬½Óןu¾ÝÒѾ*ÖÎoÍeµÄÀaºÍÄ£¿eµÄÐÅÏ¢£¬½¨Á¢ÏaÓ¦µÄË÷Òý£¬Éu³ÉxmlÎļþ£¬¶ÔÓÚÉu³ÉµÄxmlÎļþ£¬Ê¹Óö¨ÖƵÄÄ£°aÊa³oΪָ¶¨¸ñʽµÄÎļþ¡£
2. °²×°phpDocumentor
ºÍÆaËupearϵÄÄ£¿eÒ»Ñu£¬phpDocumentorµÄ°²×°Ò²ÖΪ×Ô¶¯°²×°ºÍÊÖ¶¯°²×°Á½Öֽʽ£¬Á½Öֽʽ¶¼Ç³£*½±a£º
a£® ͨ¹ýpear ×Ô¶¯°²×°
ÔÚÃuÁiÐÐÏÂÊaÈe
pear install PhpDocumentor
b£® ÊÖ¶¯°²×°
ÔÚhttp://manual.phpdoc.org/ÏÂÔØ×iаae±¾µÄPhpDocumentor£¨ÏÖÔÚÊÇ1.4.0£(C)£¬°ÑÄÚÈݽaѹ¼´¿É¡£
3£®ÔoÑuʹÓÃPhpDocumentorÉu³ÉÎĵµ
ÃuÁiÐнʽ£º
ÔÚphpDocumentorËuÔÚĿ¼Ï£¬ÊaÈe
Php ¨Ch
»aµÃµ½Ò»¸oÏeϸµÄ²ÎÊý±i£¬ÆaÖм¸¸oÖØÒªµÄ²ÎÊýÈçÏ£º
-f Òª½øÐÐÖÎoµÄÎļþÃu£¬¶a¸oÎļþÓöººÅ¸o¿ª
-d ÒªÖÎoµÄĿ¼£¬¶a¸oĿ¼ÓöººÅÖ¸i
-t Éu³ÉµÄÎĵµµÄ´aež¶
-o Êa³oµÄÎĵµ¸ñʽ£¬½a¹¹ÎªÊa³o¸ñʽ£º×ª»»Æ÷Ãu£ºÄ£°aĿ¼¡£
ÀýÈ磺phpdoc -o HTML:frames:earthli -f test.php -t docs
Web½çÃaeÉu³É
ÔÚеÄphpdocÖУ¬³ýÁËÔÚÃuÁiÐÐÏÂÉu³ÉÎĵµÍa£¬»¹¿ÉÒÔÔÚ¿Í»§¶Ëa¯ÀÀÆ÷ÉϲÙ×÷Éu³ÉÎĵµ£¬¾ßÌa½¨ÊÇÏÈ°ÑPhpDocumentorµÄÄÚÈÝÅÔÚapacheĿ¼ÏÂʹµÃͨ¹ýa¯ÀÀÆ÷¿ÉÒÔÃÎʵ½£¬*ÃÎʺoÏÔʾÈçϵĽçÃae£º
µa»÷files°´Å¥£¬Ñ¡ÔñÒª´¦ÀiµÄphpÎļþ»oÎļþ¼Ð£¬»¹¿ÉÒÔͨ¹ý¸ÃÖ¸¶¨¸Ã½çÃaeϵÄFiles to ignoreÀ´ºoÂÔ¶ÔijÐ(C)ÎļþµÄ´¦Ài¡£
È»ºoµa»÷output°´Å¥À´Ñ¡ÔñÉu³ÉÎĵµµÄ´aež¶ºÍ¸ñʽ.
×iºoµa»÷create£¬phpdocumentor¾Í»a×Ô¶¯¿ªÊ¼Éu³ÉÎĵµÁË£¬×iÏÂ*½»aÏÔʾÉu³ÉµÄ½ø¶È¼°×´Ì¬£¬Èç¹u³É¹¦£¬»aÏÔʾ
Total Documentation Time: 1 seconds
done
Operation Completed!!
È»ºo£¬ÎÒÃǾͿÉÒÔͨ¹ý²e¿´Éu³ÉµÄÎĵµÁË£¬Èç¹uÊÇpdf¸ñʽµÄ£¬Ãu×ÖĬÈÏΪdocumentation.pdf¡£
4£®¸øphp´uÂeÌi¼Ó¹ae¶µÄ×¢ÊÍ
PHPDocumentÊÇ´ÓÄaµÄÔ´´uÂeµÄ×¢ÊÍÖÐÉu³ÉÎĵµ£¬Òo´ËÔÚ¸øÄaµÄ³ÌÐo×o×¢Ê͵Ĺý³Ì£¬Ò²¾ÍÊÇÄa±aÖÆÎĵµµÄ¹ý³Ì¡£
´ÓÕaÒ»µaÉϽ²£¬PHPdoc´ÙʹÄaÒªÑø³ÉÁ¼ºÃµÄ±a³ÌÏ°¹ß£¬¾¡Á¿Ê¹Óùae¶£¬ÇaÎuÎÄ×ÖΪÄaµÄ³ÌÐo×o×¢ÊÍ£¬Í¬Ê±¶a¶aÉÙÉÙÒ²±ÜÃaÁËʺo±aÖÆÎĵµºÍÎĵµµÄ¸uв»Í¬²½µÄÒ»Ð(C)ÎÊÌa¡£
ÔÚphpdocumentorÖУ¬×¢ÊÍÖΪÎĵµÐÔ×¢ÊͺÍÇÎĵµÐÔ×¢ÊÍ¡£
ËuνÎĵµÐÔ×¢ÊÍ£¬ÊÇÄÇÐ(C)ÅÔÚÌض¨¹Ø¼u×ÖÇ°ÃaeµÄ¶aÐÐ×¢ÊÍ£¬Ìض¨¹Ø¼u×ÖÊÇÖ¸Äܹ»±»phpdocÖÎoµÄ¹Ø¼u×Ö£¬ÀýÈçclass£¬varµÈ£¬¾ßÌaµÄ¿É²Î¼Ó¸½Â¼1.
ÄÇÐ(C)ûÓÐÔڹؼu×ÖÇ°Ãae»oÕß²»¹ae¶µÄ×¢Ê;ͳÆ×÷ÇÎĵµÐÔ×¢ÊÍ£¬ÕaÐ(C)×¢Êͽ«²»»a±»phpdocËu*ÖÎo£¬Ò²²»»a³oÏÖÔÚÄa²uÉuµÄapiÎĵ±ÖС£
3.2ÈçºÎÊeдÎĵµÐÔ×¢ÊÍ:
ËuÓеÄÎĵµÐÔ×¢ÊͶ¼ÊÇÓÉ/*¿ªÊ¼µÄÒ»¸o¶aÐÐ×¢ÊÍ£¬ÔÚphpDocumentorÀi³ÆΪDocBlock, DocBlockÊÇÖ¸Èi¼þ¿ª¢ÈËÔ±±aдµÄ¹ØÓÚij¸o¹Ø¼u×ֵİiÖuÐÅÏ¢£¬Ê¹µÃÆaËuÈËÄܹ»Í¨¹ýËuÖªµÀÕa¸o¹Ø¼u×ֵľßÌaÓÃ;£¬ÈçºÎʹÓᣠPhpDocumentor¹ae¶¨Ò»¸oDocBlock°uº¬ÈçÏÂÐÅÏ¢£º
1. ¹¦ÄܼoÊoÇø
2. Ïeϸ˵Ã÷Çø
3. ±e¼Çtag
ÎĵµÐÔ×¢Ê͵ĵÚÒ»ÐÐÊǹ¦ÄÜÃeÊoÇø£¬ÕýÎÄÒ»°aÊǼoÃ÷¶oÒªµØ˵Ã÷Õa¸oÀa£¬½¨»oÕߺ¯ÊýµÄ¹¦ÄÜ£¬¹¦ÄܼoÊoµÄÕýÎÄÔÚÉu³ÉµÄÎĵµÖн«ÏÔʾÔÚË÷ÒýÇø¡£¹¦ÄÜÃeÊoÇøµÄÄÚÈÝ¿ÉÒÔͨ¹ýÒ»¸o¿ÕÐлoÕß . À´½aÊø
ÔÚ¹¦ÄÜÃeÊoÇøºoÊÇÒ»¸o¿ÕÐУ¬½Ó×ÅÊÇÏeϸ˵Ã÷Çø,. Õa²¿ÖÖ÷ÒªÊÇÏeϸ˵Ã÷ÄaµÄAPIµÄ¹¦ÄÜ£¬ÓÃ;£¬Èç¹u¿ÉÄÜ£¬Ò²¿ÉÒÔÓÐÓè¾ÙÀýµÈµÈ¡£ÔÚÕa²¿Ö£¬ÄaÓ¦¸Ã×ÅÖزuÃ÷ÄaµÄAPIº¯Êý»oÕß½¨µÄͨ³£µÄÓÃ;£¬Ó裬²¢ÇÒÖ¸Ã÷ÊÇñÊÇ¿çƽ̨µÄ£¨Èç¹uÉae¼°µ½£(C)£¬¶ÔÓÚºÍƽ̨Ïa¹ØµÄÐÅÏ¢£¬ÄaÒªºÍÄÇÐ(C)ͨÓõÄÐÅÏ¢Çø±ð¶Ô´ý£¬Í¨³£µÄ×o¨ÊÇÁiÆðÒ»ÐУ¬È»ºoд³oÔÚij¸oÌض¨Æ½Ì¨ÉϵÄ×¢ÒaÊÂÏi»oÕßÊÇÌرðµÄÐÅÏ¢£¬ÕaÐ(C)ÐÅÏ¢Ó¦¸Ã×a¹»£¬ÒÔ±aÄaµÄ¶ÁÕßÄܹ»±aдÏaÓ¦µÄ²aÊÔÐÅÏ¢£¬±ÈÈç±ß½çÌo¼þ£¬²ÎÊý*¶Î§£¬¶ÏµaµÈµÈ¡£
Ö®ºoͬÑuÊÇÒ»¸o¿Õ°×ÐУ¬È»ºoÊÇÎĵµµÄ±e¼Çtag£¬Ö¸Ã÷Ò»Ð(C)¼¼ÊoÉϵÄÐÅÏ¢£¬Ö÷ÒªÊÇ×iÖ÷ÒªµÄÊǵ÷ÓòÎÊýÀaÐÍ£¬µ»ØÖµ¼«ÆaÀaÐÍ£¬¼Ì³Ð¹Øϵ£¬Ïa¹Ø½*¨/º¯ÊýµÈµÈ¡£
¹ØÓÚÎĵµ±e¼Ç£¬ÏeϸµÄÇe²Î¿¼µÚËĽÚ:Îĵµ±e¼Ç¡£
Îĵµ×¢ÊÍÖл¹¿ÉÒÔʹÓÃÀýÈç ÕaÑuµÄ±eÇ(C)£¬Ïeϸ½eÉÜÇe²Î¿¼¸½Â¼¶þ¡£
ÏÂÃaeÊÇÒ»¸oÎĵµ×¢Ê͵ÄÀý×Ó
/**
5£®Îĵµ±e¼Ç£º
Îĵµ±e¼ÇµÄʹÓöΧÊÇÖ¸¸Ã±e¼Ç¿ÉÒÔÓÃÀ´ÐÞÊεĹؼu×Ö£¬»oÆaËuÎĵµ±e¼Ç¡£
ËuÓеÄÎĵµ±e¼Ç¶¼ÊÇÔÚÿһÐÐµÄ ºoÃaeÒÔ@¿ªÍ¡£Èç¹uÔÚÒ»¶Î»°µÄÖмa³oÀ´@µÄ±e¼Ç£¬Õa¸o±e¼Ç½«»a±»µ±×oÆÕͨÄÚÈݶø±»ºoÂÔµo¡£
@access
ʹÓöΧ£ºclass,function,var,define,module
¸Ã±e¼ÇÓÃÓÚÖ¸Ã÷¹Ø¼u×ֵĴaeȡȨÏÞ£ºprivate¡¢public»oproteced
@author
Ö¸Ã÷×÷Õß
@copyright
ʹÓöΧ£ºclass£¬function£¬var£¬define£¬module£¬use
Ö¸Ã÷°aeȨÐÅÏ¢
@deprecated
ʹÓöΧ£ºclass£¬function£¬var£¬define£¬module£¬constent£¬global£¬include
Ö¸Ã÷²»ÓûoÕßÏÆuµÄ¹Ø¼u×Ö
@example
¸Ã±e¼ÇÓÃÓÚ½aÎoÒ»¶ÎÎļþÄÚÈÝ£¬²¢½«ËuÃǸßÁÁÏÔʾ¡£Phpdoc»aÊÔͼ´Ó¸Ã±e¼Ç¸øµÄÎļþ¾¶ÖжÁÈ¡ÎļþÄÚÈÝ
@const
ʹÓöΧ£ºdefine
ÓÃÀ´Ö¸Ã÷phpÖÐdefineµÄ³£Á¿
@final
ʹÓöΧ£ºclass,function,var
Ö¸Ã÷¹Ø¼u×ÖÊÇÒ»¸o×iÖÕµÄÀa¡¢½¨¡¢ÊoÐÔ£¬½uÖ¹ÅÉÉu¡¢Ð޸ġ£
@filesource
ºÍexampleÀaËÆ£¬Ö»²»¹ý¸Ã±e¼Ç½«Ö±½Ó¶ÁÈ¡µ±Ç°½aÎoµÄphpÎļþµÄÄÚÈݲ¢ÏÔʾ¡£
@global
Ö¸Ã÷Ôڴ˺¯ÊýÖÐÒýÓõÄÈ«¾Ö±aÁ¿
@ingore
ÓÃÓÚÔÚÎĵµÖкoÂÔÖ¸¶¨µÄ¹Ø¼u×Ö
@license
Ïaµ±ÓÚhtml±eÇ(C)ÖеÄ,Ê×ÏÈÊÇURL£¬½Ó×ÅÊÇÒªÏÔʾµÄÄÚÈÝ
ÀýÈç°Ù¶È
¿ÉÒÔд×÷ @license http://www.baidu.com °Ù¶È
@link
ÀaËÆÓÚlicense
µ«»¹¿ÉÒÔͨ¹ýlinkÖ¸µ½ÎĵµÖеÄÈκÎÒ»¸o¹Ø¼u×Ö
@name
Ϊ¹Ø¼u×ÖÖ¸¶¨Ò»¸o±ðÃu¡£
@package
ʹÓöΧ£ºÒ³Ãae¼¶±ðµÄ-> define£¬function£¬include
Àa¼¶±ðµÄ->class£¬var£¬methods
ÓÃÓÚÂß¼ÉϽ«Ò»¸o»o¼¸¸o¹Ø¼u×ÖÖµ½Ò»×e¡£
@abstrcut
˵Ã÷µ±Ç°ÀaÊÇÒ»¸o³eÏoÀa
@param
Ö¸Ã÷Ò»¸oº¯ÊýµÄ²ÎÊý
@return
Ö¸Ã÷Ò»¸o½¨»oº¯ÊýµÄµ»ØÖ¸
@static
Ö¸Ã÷¹Ø½¨×ÖÊǾ²Ì¬µÄ¡£
@var
Ö¸Ã÷±aÁ¿ÀaÐÍ
@version
Ö¸Ã÷°ae±¾ÐÅÏ¢
@todo
Ö¸Ã÷Ó¦¸Ã¸Ä½ø»oûÓÐʵÏֵĵؽ
@throws
Ö¸Ã÷´Ëº¯Êý¿ÉÄÜÅ׳oµÄ´iÎoÒi³£,¼«Æa¢ÉuµÄÇe¿o
ÉÏÃaeÌaµ½¹ý£¬ÆÕͨµÄÎĵµ±e¼Ç±e¼Ç±ØÐeÔÚÿÐеĿªÍÒÔ@±e¼Ç£¬³ý´ËÖ®Ía£¬»¹ÓÐÒ»ÖÖ±e¼Ç½Ð×oinline tag,ÓÃ{@}±iʾ£¬¾ßÌa°uÀ¨ÒÔϼ¸ÖÖ£º
{@link}
Óèͬ@link
{@source}
ÏÔʾһ¶Îº¯Êý»o½*¨µÄÄÚÈÝ
6£®Ò»Ð(C)×¢Ê͹ae*¶
a.×¢ÊͱØÐeÊÇ
/**
µ±Ç°1/2Ò³ 12ÏÂÒ»Ò³ÔĶÁÈ«ÎÄ