我试图摆脱 YUIdoc 的困扰,但我无法让它工作:这是我的 PHP 代码的一部分:
/**
* Estimates whether a number is odd or even
*
*@method odd_or_even
*@param num {number} String to fix
*@return {Boolean} Returns True on even number, False on odd
*/
function odd_or_even($num)
{
return ($num%2); // Returns 0 for odd and 1 for even
}
/**
* Detects if user runs one of the most common browsers
*
*@method detect_browser
*@return {string} Returns the browser name. 'Undefined' for undefined
*/
function detect_browser()
{
$useragent = $_SERVER['HTTP_USER_AGENT'];
if(strpos($useragent, 'MSIE'))
$browser = 'Internet explorer';
elseif(strpos($useragent, 'Firefox'))
$browser = 'Firefox';
elseif(strpos($useragent, 'Chrome'))
$browser = 'Google Chrome';
elseif(strpos($useragent, 'Opera'))
$browser = 'Opera';
elseif(strpos($useragent, 'Safari'))
$browser = 'Safari';
elseif(strpos($useragent, 'SeaMonkey'))
$browser = 'SeaMonkey';
elseif(strpos($useragent, 'Flock'))
$browser = 'Flock';
elseif(strpos($useragent, 'Prism'))
$browser = 'Prism';
elseif(strpos($useragent, 'Deepnet Explorer'))
$browser = 'Deepnet Explorer';
elseif(strpos($useragent, 'Maxthon'))
$browser = 'Maxthon';
elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'Avant'))
$browser = 'Avant';
elseif(strpos($useragent, 'Camino'))
$browser = 'Camino';
elseif(strpos($useragent, 'Shiira'))
$browser = 'Shiira';
elseif(strpos($useragent, 'OmniWeb'))
$browser = 'OmniWeb';
elseif(strpos($useragent, 'iCab'))
$browser = 'iCab';
elseif(strpos($useragent, 'Stainless'))
$browser = 'Stainless';
elseif(strpos($useragent, 'Fluid'))
$browser = 'Fluid';
elseif(strpos($useragent, 'Konqueror'))
$browser = 'Konqueror';
elseif(strpos($useragent, 'Galeon'))
$browser = 'Galeon';
elseif(strpos($useragent, 'Epiphany'))
$browser = 'Epiphany';
elseif(strpos($useragent, 'Swiftfox'))
$browser = 'Swiftfox';
elseif(strpos($useragent, 'Swiftweasel'))
$browser = 'Swiftweasel';
else
$browser = 'Undefined';
return $browser;
}
保存为 lib.php 然后我运行 'yuidoc 。这是输出:
info: (yuidoc): Starting YUIDoc@0.3.13 using YUI@3.5.1 with NodeJS@0.6.12
info: (yuidoc): Scanning for yuidoc.json file.
info: (yuidoc): Starting YUIDoc with the following options:
info: (yuidoc): { port: 3000, nocode: false, paths: [ '.' ], outdir: './out' }
info: (yuidoc): YUIDoc Starting from: .
info: (yuidoc): Making out dir: ./out
info: (yuidoc): Parsed 0 files in 0.004 seconds
info: (builder): Building..
info: (builder): Compiling Templates
info: (builder): Making default directories: classes,modules,files
info: (builder): Copying Assets
info: (builder): Rendering and writing 0 modules pages.
info: (builder): Finished writing module files
info: (builder): Rendering and writing 0 class pages.
info: (builder): Finished writing class files
info: (builder): Rendering and writing 0 source files.
info: (builder): Finished writing source files
info: (builder): Preparing index.html
info: (builder): Loading theme from/usr/local/lib/node_modules/yuidocjs/themes/default/theme.json
info: (builder): Writing API Meta Data
info: (builder): Writing index.html
info: (builder): Finished writing 1 files in 0.077 seconds
info: (yuidoc): Completed in 0.085 seconds
而且文档是空的。我也尝试过使用 javascript,结果相同。我错了什么?
提前谢谢亚当