3C科技 娛樂遊戲 美食旅遊 時尚美妝 親子育兒 生活休閒 金融理財 健康運動 寰宇綜合

Zi 字媒體

2017-07-25T20:27:27+00:00
加入好友
首先可以先看一下PHP_CodeSniffer官網的定義 PHP_CodeSniffer is a PHP5 script that tokenises and "sniffs" PHP, JavaScript and CSS files to detect violations of a defined coding standard. It is an essential development tool that ensures your code remains clean and consistent. It can also help prevent some common semantic errors made by developers. PHP_CodeSniffer主要功用就是用來檢測程式碼中是否有符合一般開發的標準(只限於PHP5),簡單說就是CodingStyle。 安裝 #pear安裝 pear install PHP_CodeSniffer #composer安裝 composer global require 'squizlabs/php_codesniffer=*' #之後記得要把 ~/.composer/vendor/bin/ 路徑export到自己的bash_profile 基本操作 #檢查程式 phpcs myprog.php #檢查目錄裡所有程式 phpcs project/ 查看phpcs可檢測的coding standards phpcs -i 更換coding standards phpcs --standard=Zend project/ 修改預設coding standards(需要有寫入檔案的權限) phpcs --config-set default_standard Zend 查看設定檔裡的設定 phpcs --config-show 顯示哪支sniff code檢查的 phpcs -s project/ 不要顯示WARNING的資訊 phpcs -s project/ 修改報表格式 phpcs --report=summary project/ 忽略部份檔案或目錄 #忽略application和public兩個目錄 phpcs --ignore=application/,public/ project/ PHP_CodeSniffer還可以做很多事,其他參數的問題可以直接查詢官網的Coding Standard Tutorial Categories: PHP 分類 Android AngularJS API Blueprint Chrome Database MySQL DataStructure Docker Editor Vim Firefox Git GitLab Google API Hadoop Language Go Java JavaScript jQuery jQueryChart Node.js Vue PHP Laravel ZendFramework Python Mac Network Cisco DLink Juniper Oauth Server Apache Share Unix FreeBSD Linux WebDesign Bootstrap CSS HTML Wordpress Search 搜尋關鍵字:

本文由blogjohnsonluorg提供 原文連結

寫了 5860316篇文章,獲得 23313次喜歡
精彩推薦