一、在程序中打断点调试:PHP Debug
二、高级自动完成和重构支持(代码智能提示):PHP IntelliSense
配置:
"php.suggest.basic": false, // 插件作者建议禁用VS代码内置的PHP智能感知设置php.suggest.basic,以false避免重复的建议
"php.validate.executablePath": "D://phpStudy//PHPTutorial//php//php-7.2.1-nts//php.exe" //指向php可执行文件(最少在php7.0版本以上)
三、Ctrl + S自动格式化php代码:phpfmt - PHP formatter
默认使用 PSR2 规范
四、Ctrl + S自动格式化php代码:php cs fixer
配置:
"php-cs-fixer.onsave": true, //Ctrl + S 时格式化php代码
"php-cs-fixer.formatHtml": true //格式化.php文件中的html代码(html、css、js)
五、生成函数的注释:PHP DocBlocker(/**)
六、生成自定义文件头信息:vscode-fileheader(Ctrl + Alt + I)
七、Ctrl+; 行尾自动添加分号:macros
1.配置:
"macros": {
"end_semicolon": [ // 末尾加分号
"cursorLineEnd",
{
"command": "type",
"args": {
"text": ";"
}
}
]
}
2.keybindings.json 中设置按键绑定:
[{
"key": "ctrl+;",
"command": "macros.end_semicolon"
}]