windows Netbeans 和 PhpDocumentor

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4257513/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 15:39:32  来源:igfitidea点击:

Netbeans and PhpDocumentor

windowsuser-interfacenetbeansphpdoc

提问by Rooneyl

I have downloaded Netbeans 7.0 beta as I wanted to give the PhpDoc functionality a bash, but can't get it to work. I seem to be falling over on the configuration options for PhpDoc in netbeans. It is asking for the script location, alt text

我已经下载了 Netbeans 7.0 测试版,因为我想给 PhpDoc 功能一个 bash,但无法让它工作。我似乎对 netbeans 中 PhpDoc 的配置选项感到失望。它要求脚本位置, 替代文字

but whatever I enter I get the error;

但无论我输入什么,我都会收到错误消息;

** ERROR *****************************************************************
* Sorry, can't find the php.exe file.
* You must edit this file to point to your php.exe (CLI version!)
*    [Currently set to C:\usr\local\php\cli\php.exe]
* 
* NOTE: In PHP 4.2.x the PHP-CLI used to be named php-cli.exe. 
*       PHP 4.3.x renamed it php.exe but stores it in a subdir 
*       called /cli/php.exe
*       E.g. for PHP 4.2 C:\phpdev\php-4.2-Win32\php-cli.exe
*            for PHP 4.3 C:\phpdev\php-4.3-Win32\cli\php.exe
**************************************************************************
Press any key to continue . . . 

The set-up is Netbeans and xampp running on a windows machine.

设置是在 Windows 机器上运行的 Netbeans 和 xampp。

Any and all help greatly appreciated.

非常感谢任何和所有帮助。

回答by ashnazg

That error indicates that the php.exe executable file is not in your Windows "PATH", and as such, when Windows tries to run the phpdoc script, it doesn't know how. Fortunately, the phpdoc script itself checks for this condition and explains it to you, in the error text you posted. Otherwise, the Windows error would have been much more generic and probably unhelpful.

该错误表明 php.exe 可执行文件不在您的 Windows“路径”中,因此,当 Windows 尝试运行 phpdoc 脚本时,它不知道如何运行。幸运的是,phpdoc 脚本本身会检查这种情况并在您发布的错误文本中向您解释。否则,Windows 错误会更普遍,而且可能无济于事。

You need to determine where your php.exe file is located. Then, edit the phpdoc.bat script file itself to hardcode the absolute path. Look for the line near the beginning that SETs the phpCli value. That is where you should place the absolute path to your php.exe file.

您需要确定 php.exe 文件所在的位置。然后,编辑 phpdoc.bat 脚本文件本身以硬编码绝对路径。查找设置 phpCli 值的开头附近的行。这是您应该放置 php.exe 文件的绝对路径的地方。

As an aside, I would suggest that your "PhpDoc script" setting in NetBeans should explicitly call the phpdoc.bat script rather than just "phpdoc", e.g. D:\xampp\php\phpdoc.bat, since both files actually exist. I know that Windows will typically look for "foo.bat" if you tell it to execute "foo" when foo doesn't exist and foo.bat does exist, but since phpdoc and phpdoc.bat both exist, ... I think that Windows trying to run phpdoc directly rather than phpdoc.bat will give you trouble.

顺便说一句,我建议您在 NetBeans 中的“PhpDoc 脚本”设置应该明确调用 phpdoc.bat 脚本,而不仅仅是“phpdoc”,例如 D:\xampp\php\phpdoc.bat,因为这两个文件实际上都存在。我知道 Windows 通常会寻找“foo.bat”,如果你告诉它在 foo 不存在并且 foo.bat 确实存在时执行“foo”,但是由于 phpdoc 和 phpdoc.bat 都存在,......我认为Windows 试图直接运行 phpdoc 而不是 phpdoc.bat 会给你带来麻烦。

Further, I see that you have the phpdoc.bat file itself listed as the first "argument" to the phpdoc script. That will probably cause you some grief once you get past the "can't find php.exe" error. You should remove that... the only arguments you should give after naming the script itself are the valid arguments that phpDocumentor expects, particularly the ones it requires-- -o for output template, -t for where to write the doc files, -d or -f to tell it where the PHP code is that you want documented.

此外,我看到您将 phpdoc.bat 文件本身列为 phpdoc 脚本的第一个“参数”。一旦您克服了“找不到 php.exe”错误,这可能会给您带来一些痛苦。您应该删除它...在命名脚本本身后您应该提供的唯一参数是 phpDocumentor 期望的有效参数,特别是它需要的参数-- -o 用于输出模板,-t 用于编写 doc 文件的位置,- d 或 -f 告诉它你想要记录的 PHP 代码在哪里。

回答by Néstor

for my case, in the version 2: i changed the last line in phpdoc.bat:

就我而言,在版本 2 中:我更改了 phpdoc.bat 中的最后一行:

"%PHPBIN%" "%PHP_PERAR_BIN_DIR%\phpdoc.php" %*

to

"%PHPBIN%" "phpdoc.php" %*

%PHP_PERAR_BIN_DIR%in this case is empty & the backslash makes an error finding the phpdoc.php file

%PHP_PERAR_BIN_DIR%在这种情况下为空并且反斜杠在查找 phpdoc.php 文件时出错

回答by jellysandwich

I finally figured out an easy way to use phpdoc in Netbeans Windows!

我终于找到了一种在 Netbeans Windows 中使用 phpdoc 的简单方法!

Pear? Drop it. There's way too many problems.

梨?算了吧。问题太多了

  1. Download it directly - http://sourceforge.net/projects/phpdocu/files/
  2. Download the tar file, not the zip. The zip is bugged and will output 2 letter extensions instead of 3 (ie, .cs instead of .css) (as of 1.4.3)
  3. Unzip it anywhere you want
  4. Open up the phpdoc.bat file, and make 2 changes
  5. a) Change the phpcli path
  6. b) Add in code to navigate to the directory.
  1. 直接下载 - http://sourceforge.net/projects/phpdocu/files/
  2. 下载 tar 文件,而不是 zip。zip 被窃听,将输出 2 个字母扩展名而不是 3 个(即,.cs 而不是 .css)(从 1.4.3 开始)
  3. 解压到任何你想要的地方
  4. 打开phpdoc.bat文件,进行2处修改
  5. a) 更改phpcli路径
  6. b) 添加代码以导航到目录。

So for example, I put my phpdocumentor folder in d:\programs\xampp\php\phpdoc. Modifying the phpdoc.bat file:

例如,我将我的 phpdocumentor 文件夹放在 d:\programs\xampp\php\phpdoc 中。修改phpdoc.bat文件:

    SET phpCli=d:\programs\xampp\php\php.exe
    d:
    cd d:\programs\xampp\php\phpdoc

Then in Netbeans, you put this for the phpdoc script:

然后在 Netbeans 中,您将其放在 phpdoc 脚本中:

    D:\programs\xampp\php\phpdoc\phpdoc.bat -o HTML:frames:earthli

Note that when you set the target (right click on project -> properties -> phpdoc), you will need to manually change the backslashes to forward slashes.

请注意,当您设置目标时(右键单击项目 -> 属性 -> phpdoc),您将需要手动将反斜杠更改为正斜杠。

  • Correct - D:/programs/xampp/htdocs/project/phpdoc
  • Incorrect - D:\programs\xampp\htdocs\project\phpdoc (this will be generated when you use the browse button)
  • 正确 - D:/programs/xampp/htdocs/project/phpdoc
  • 不正确 - D:\programs\xampp\htdocs\project\phpdoc(使用浏览按钮时会生成这个)

Good luck!

祝你好运!

PS. Note that you can also run the phpdoc batch file directly from dos. You don't need to do it through netbeans.

附注。请注意,您也可以直接从 dos 运行 phpdoc 批处理文件。您不需要通过 netbeans 来完成。

    d:\programs\xampp\php\phpdoc\phpdoc.bat -d D:\programs\xampp\htdocs\project -t D:\programs\xampp\htdocs\project\phpdoc -o HTML:frames:phpedit