sublime安装php_beautifier来格式化PHP代码 环境 安装php_beautifier

注:如果你使用sublime3,php版本是5.6以上,推荐使用这个插件phpfmt

  • 操作系统:windows7
  • sublime版本:2.0.2
  • PHP安装路径: D:wampinphpphp5.3.13

安装php_beautifier

  1. 下载go-pear.phar 到php安装目录下,地址http://pear.php.net/go-pear.phar 。
  2. 打开CMD命令行,切换到phar文件位置,执行php go-pear.phar,根据提示一直回车就行了。
  3. 安装完go-pear会发现目录下面会多出pear目录、phpbeautifier.bat、PEARENV.reg文件等。双击PEAR_ENV.reg导入
  4. 命令行执行pear install PHP_Beautifier-0.1.15
  5. 通过sublime的package控制器直接安装PhpBeautifier
  6. 打开D:wampinphpphp5.3.13pearPHPBeautifierFilter下面的Pear.filter.php及phpBB.filter.php文件注释掉require_once ('PEAR/Config.php');这行代码
  7. 打开sublime的phpbeautifier的插件文件(sublime下Preferences-browse packages),找到PhpBeautifierphpbeautifier.py,打开他,到26行,修改cmd = "php_beautifier"cmd = "D:\wamp\bin\php\php5.3.13\php_beautifier.bat"
  8. 最后在php文件中使用 ctrl+alt+f 就可以格式化php的代码

参考:sublime安装格式化php代码插件(PHP_Beautifier)

 sublime安装php_beautifier来格式化PHP代码
环境
安装php_beautifier
 
sublime安装php_beautifier来格式化PHP代码
环境
安装php_beautifier
 
sublime安装php_beautifier来格式化PHP代码
环境
安装php_beautifier
 
 
sublime安装php_beautifier来格式化PHP代码
环境
安装php_beautifier