如何配置SublimeText3中的php語法錯誤提示插件

如何配置Sublime Text 3中的php語法錯誤提示插件?相信很多沒有經(jīng)驗的人對此束手無策,為此本文總結(jié)了問題出現(xiàn)的原因和解決方法,通過這篇文章希望你能解決這個問題。

專注于為中小企業(yè)提供成都網(wǎng)站制作、成都網(wǎng)站設(shè)計、外貿(mào)營銷網(wǎng)站建設(shè)服務(wù),電腦端+手機端+微信端的三站合一,更高效的管理,為中小企業(yè)黃山區(qū)免費做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動了近千家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實現(xiàn)規(guī)模擴充和轉(zhuǎn)變。

Sublime Text 3配置php語法錯誤提示插件的方法:首先下載sniffer插件安裝包;然后下載插件并放到php.exe安裝目錄里;接著設(shè)置都改成本地環(huán)境下的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環(huán)境下的配置樣例

第六步:以下就是windows-7-phpcs-fixer-linter.example的配置內(nèi)容,打開你的Sublime Text 3->Preferences->Package Settings -> Php Code Sniffer -> Settings - User ,復(fù)制windows-7-phpcs-fixer-linter.example的內(nèi)容到配置文件phpcs.sublime-settings,然后修改對應(yīng)的php.exe路徑

設(shè)置都改成你本地環(huán)境下的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程序,語法錯誤提示如下圖:

如何配置Sublime Text 3中的php語法錯誤提示插件

看完上述內(nèi)容,你們掌握如何配置Sublime Text 3中的php語法錯誤提示插件的方法了嗎?如果還想學(xué)到更多技能或想了解更多相關(guān)內(nèi)容,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝各位的閱讀!

文章標(biāo)題:如何配置SublimeText3中的php語法錯誤提示插件
文章源于:http://muchs.cn/article30/gdchso.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站改版、ChatGPT外貿(mào)網(wǎng)站建設(shè)、微信公眾號搜索引擎優(yōu)化、網(wǎng)站營銷

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都做網(wǎng)站