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-commands.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_command_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_command_on_save": false,"phpmd_executable_path": "","phpmd_additional_args": {}}
重启sublime text 3,打开php程序,语法错误提示如下图:
相关学习推荐:php编程从入门到精通
以上就是sublime text 3如何配置php语法错误提示插件?的详细内容。