Sublime Text 3如何配置php语法错误提示插件?-PHP问题

资源魔 73 0

Sublime Text 3设置装备摆设php语法谬误提醒插件的办法:起首下载sniffer插件装置包;而后下载插件并放到php.exe装置目次里;接着设置都改为内陆环境下的php装置门路;最初保留,重启Sublime Text 3便可。

Sublime Text 3设置装备摆设php语法谬误提醒插件的办法:

第一步:下载php code sniffer插件装置包

解压装置包失去sublime-phpcs-master,把sublime-phpcs-master文件夹放到sublime装置目次下的Data/Packages/目次下;

重启sublime, 关上Sublime Text 3->Preferences->Package Settings -> Php Code Sniffer 证实插件装置胜利;

第二步:下载php-cs-fixer.phar

第三步:把php-cs-fixer.phar 放到你的 php.exe 装置目次 (例如(mine is C:/WAMP/php/php.exe));

第四步:下载 http://download.pear.php.net/package/PHP_CodeSniffer-1.5.0RC4.tgz,解压,而后找到scripts目次下的phpcs.bat,放到php.exe 装置目次;

第五步:解压关上,正在子文件example-settings下有个文件

windows-7-phpcs-fixer-linter.example就是Sublime Text 3 正在windows7设置装备摆设 PHPCS 的样例,另有一个nix-all-co妹妹ands.example是正在linux/unix环境下的设置装备摆设样例

第六步:如下就是windows-7-phpcs-fixer-linter.example的设置装备摆设内容,关上你的Sublime Text 3->Preferences->Package Settings -> Php Code Sniffer -> Settings - User ,复制windows-7-phpcs-fixer-linter.example的内容到设置装备摆设文件phpcs.sublime-settings,而后修正对应的php.exe门路

设置都改为你内陆环境下的php装置门路,保留,重启Sublime Text 3

{
// Path to php on windows installation
// This is needed as we cannot run phars on windows, so we run it through php
"phpcs_php_prefix_path": "C:\\wamp\\bin\\php\\php5.4.12\\php.exe",
// This is the path to the bat file when we installed PHP_CodeSniffer
"phpcs_executable_path": "C:\\wamp\\bin\\php\\php5.4.12\\phpcs.bat",
// PHP-CS-Fixer settings
// Don't want to auto fix issue with php-cs-fixer
"php_cs_fixer_on_save": false,
// Show the quick panel
"php_cs_fixer_show_quick_panel": true,
// The fixer phar file is stored here:
"php_cs_fixer_executable_path": "C:\\wamp\\bin\\php\\php5.4.12\\php-cs-fixer.phar",
// PHP Linter settings
// Yes, lets lint the files
"phpcs_linter_run": true,
// And execute that on each file when saved (php only as per extensions_to_execute)
"phpcs_linter_co妹妹and_on_save": true,
// Path to php
"phpcs_php_path": "C:\\wamp\\bin\\php\\php5.4.12\\php.exe",
// This is the regex format of the errors
"phpcs_linter_regex": "(?P<message>.*) on line (?P<line>\\d+)",
// PHP Mess Detector settings
// Not turning on the mess detector here
"phpmd_run": false,
"phpmd_co妹妹and_on_save": false,
"phpmd_executable_path": "",
"phpmd_additional_args": {}
}

重启Sublime Text 3,关上php顺序,语法谬误提醒以下图:

c3321977ed02d056bc57470c69b3588.png

相干学习保举:PHP编程从入门到通晓

以上就是Sublime Text 3若何设置装备摆设php语法谬误提醒插件?的具体内容,更多请存眷资源魔其它相干文章!

标签: php 错误 php教程 php故障解决 php使用问题 sublime

抱歉,评论功能暂时关闭!