简体   繁体   English

phpcs.bat文件不是正确的Code Sniffer批处理

[英]The file phpcs.bat isn't the right Code Sniffer batch

I've installed PHP_CodeSniffer via Pear, and have Netbeans 7.3.1 installed. 我已经通过Pear安装了PHP_CodeSniffer,并安装了Netbeans 7.3.1。 This is all on a Windows 8 system. 这一切都在Windows 8系统上。 When I go to configure Code Sniffer in Netbeans and point it towards my phpcs batch file (only one I have), I get the following error "The file C:\\Program Files (x86)\\PHP\\phpcs.bat isn't the right Code Sniffer batch!" 当我在Netbeans中配置代码嗅探器并将其指向我的phpcs批处理文件(我只有一个)时,出现以下错误“文件C:\\ Program Files(x86)\\ PHP \\ phpcs.bat不是正确的代码嗅探器批处理!”

Does anyone know how to fix this issue? 有人知道如何解决此问题吗?

A colleague had a similar problem and the solution was, that the phpcs.bat was incorrect (the path to the PHP executable was missing). 一位同事有一个类似的问题,解决方法是phpcs.bat不正确(缺少PHP可执行文件的路径)。 I seemed to be a misconfiguration of his Pyrus setup that lead to this. 我似乎是对他的Pyrus设置的错误配置,导致了这种情况。

So open a command prompt, go to the folder where your phpcs.bat is placed and try to execute phpcs -v . 因此,打开命令提示符,转到phpcs.bat所在的文件夹,然后尝试执行phpcs -v I guess you get an error (something like """" cannot be excuted [...] ). 我想您会收到一个错误( """" cannot be excuted [...]类的东西"""" cannot be excuted [...] )。

You can simply fix it. 您可以简单地修复它。 Open the batch, got to the last line and insert the full path to your php.exe between the two double quotes. 打开批处理,到达最后一行,并在两个双引号之间插入php.exe的完整路径。 After that, phpcs -v should output its name and version and the "Test" button in your Codesniffer dialog in Netbeans should work as well. 之后, phpcs -v应该输出其名称和版本,并且Netbeans中Codesniffer对话框中的“测试”按钮也应正常工作。

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

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