简体   繁体   English

Netbeans和PhpDocumentor

[英]Netbeans and PhpDocumentor

I have downloaded Netbeans 7.0 beta as I wanted to give the PhpDoc functionality a bash, but can't get it to work. 我已经下载了Netbeans 7.0 beta,因为我想给PhpDoc功能一个bash,但无法让它工作。 I seem to be falling over on the configuration options for PhpDoc in netbeans. 我似乎在netbeans中的PhpDoc的配置选项上摔倒了。 It is asking for the script location, 它要求脚本位置, 替代文字

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. 任何和所有的帮助非常感谢。

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. 该错误表明php.exe可执行文件不在Windows“PATH”中,因此,当Windows尝试运行phpdoc脚本时,它不知道如何。 Fortunately, the phpdoc script itself checks for this condition and explains it to you, in the error text you posted. 幸运的是,phpdoc脚本本身会检查这个条件并在您发布的错误文本中向您解释。 Otherwise, the Windows error would have been much more generic and probably unhelpful. 否则,Windows错误将更加通用,可能无用。

You need to determine where your php.exe file is located. 您需要确定php.exe文件的位置。 Then, edit the phpdoc.bat script file itself to hardcode the absolute path. 然后,编辑phpdoc.bat脚本文件本身以硬编码绝对路径。 Look for the line near the beginning that SETs the phpCli value. 查找设置phpCli值的开头附近的行。 That is where you should place the absolute path to your php.exe file. 这是您应该将绝对路径放在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", eg D:\\xampp\\php\\phpdoc.bat, since both files actually exist. 顺便说一下,我建议NetBeans中的“PhpDoc脚本”设置应该显式调用phpdoc.bat脚本,而不仅仅是“phpdoc”,例如D:\\ xampp \\ php \\ phpdoc.bat,因为这两个文件实际存在。 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. 我知道Windows通常会查找“foo.bat”,如果你告诉它在foo不存在时执行“foo”并且foo.bat确实存在,但由于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. 此外,我看到您将phpdoc.bat文件本身列为phpdoc脚本的第一个“参数”。 That will probably cause you some grief once you get past the "can't find php.exe" error. 一旦你越过“无法找到php.exe”错误,这可能会让你有些悲伤。 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. 您应该删除...在命名脚本本身之后应该给出的唯一参数是phpDocumentor期望的有效参数,特别是它需要的参数 - 输出模板的-o,-t用于写入doc文件的位置, - d或-f告诉它你想要记录的PHP代码在哪里。

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文件时出错

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

So for example, I put my phpdocumentor folder in d:\\programs\\xampp\\php\\phpdoc. 例如,我将我的phpdocumentor文件夹放在d:\\ programs \\ xampp \\ php \\ phpdoc中。 Modifying the phpdoc.bat file: 修改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 正确 - 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(这将在您使用浏览按钮时生成)

Good luck! 祝好运!

PS. PS。 Note that you can also run the phpdoc batch file directly from dos. 请注意,您也可以直接从dos运行phpdoc批处理文件。 You don't need to do it through netbeans. 您不需要通过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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM