我们每一位开发人员都希望自己能写出漂亮整洁的代码,但是由于在开发过程中将过多的心思都放在了开发上了,忽略了代码的整洁性,怎么办呢?我这里向大家介绍一个:PHP Code Beautifier结合Editplus打造完美代码工具。
软件:
PHP Code Beautifie(官方网站:http://www.waterproof.fr/)
Editplus(官方网站:http://www.editplus.com/)
步骤如下:
先把PHP Code Beautifie 下载下来放到Editplus安装根目录下。
然后设置参数,在Editplus下点击:工具=>参数设置=>用户工具=>添加工具=>应用程序。
1)菜单文本:自己随便写一个名字,比如我这里写"格式化代码"
2)命令浏览到我们刚放在根目录的phpCB.exe
3)参数:--space-after-if --glue-arrow --optimize-eol --space-after-switch
--space-after-while --space-before-start-angle-bracket
--one-true-brace-function-declaration --one-true-brace
--extra-padding-for-case-statement --glue-amperscore
--change-shell-comment-to-double-slashes-comment --indent-with-tab
--force-large-php-code-tag --force-true-false-null-contant-lowercase
--comment-rendering-style PEAR --equal-align-position 50
--padding-char-count 1 "$(FilePath)"
4)初始目录:$(FileDir)
5)动作:运行为文本过滤器(替换)
参数设置如下图:
执行:工具=》代码格式化。