https://www.eertime.com/archives/86.html
通过包安装管理器安装phpfmt插件.
- 在sublime界面按快捷键
ctrl+shift+P
- 选择并选择:
Install Package
- 等待片刻输入并选择
phpfmt
配置 (Windows)
打开并编辑配置文件 ( %AppData%\Sublime Text\Packages\phpfmt\phpfmt.sublime-settings )(建议编辑插件的用户配置)
将 "php_bin" 的值设置为你电脑上php.exe的路径。 例如: "php_bin":"c:/PHP/php.exe"
配置好之后默认ctrl+F11
格式化代码,也可以通过命令面板来操作
配置 (OS X and Linux)
编辑配置文件 ( phpfmt.sublime-settings )将 "php_bin" 的值设置为你电脑上php的可执行程序路径。 例如: "php_bin":"/usr/local/bin/php"
设置
{
"php_bin":"/usr/local/bin/php",
}
English
Install this plugin through Package Manager.
•In Sublime Text press ctrl+shift+P
•Choose Package Control: Install Package
•Choose phpfmt
Configuration (Windows)
•Edit configuration file ( %AppData%\Sublime Text\Packages\phpfmt\phpfmt.sublime-settings )
•For field "php_bin" enter the path to the php.exe Example: "php_bin":"c:/PHP/php.exe"
Configuration (OS X and Linux)
•Edit configuration file ( phpfmt.sublime-settings )•For field "php_bin" enter the path to the php Example: "php_bin":"/usr/local/bin/php"
Settings
Prefer using the toggle options at command palette. However you might find yourself in need to setup where PHP is running, use this option below for the configuration file.
{
"php_bin":"/usr/local/bin/php",
}
参考网址
github:https://github.com/nanch/phpfmt_stable
package control:https://packagecontrol.io/packages/phpfmt
下面是我自己的配置:
{
"format_on_save": false,
"php_bin": "E:/GreenApp/php/php-7.0.9/php.exe",
"psr1": true,
"psr1_naming": true,
"psr2": true,
"version": 1
}