{"id":223183,"date":"2024-05-11T19:14:19","date_gmt":"2024-05-11T11:14:19","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/223183.html"},"modified":"2024-05-11T19:14:29","modified_gmt":"2024-05-11T11:14:29","slug":"sublime-text-3-%e5%a6%82%e4%bd%95%e6%a0%bc%e5%bc%8f%e5%8c%96php%e4%bb%a3%e7%a0%81-2","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/223183.html","title":{"rendered":"sublime text 3 \u5982\u4f55\u683c\u5f0f\u5316PHP\u4ee3\u7801"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25142818\/b61cda2b-695a-4f58-a162-ce46400770ae.webp\" alt=\"sublime text 3 \u5982\u4f55\u683c\u5f0f\u5316PHP\u4ee3\u7801\" \/><\/p>\n<p><p><strong>Sublime Text 3 \u683c\u5f0f\u5316 PHP \u4ee3\u7801\u4e3b\u8981\u4f9d\u8d56\u4e8e\u63d2\u4ef6\u5b89\u88c5\u3001\u914d\u7f6e\u5feb\u6377\u952e\u3001\u4f7f\u7528\u7279\u5b9a\u7684\u683c\u5f0f\u5316\u8bbe\u7f6e<\/strong>\u3002\u9996\u5148\u9700\u8981\u901a\u8fc7\u5176\u5305\u7ba1\u7406\u5668\u5b89\u88c5 PHP \u4ee3\u7801\u683c\u5f0f\u5316\u76f8\u5173\u63d2\u4ef6\uff0c\u5982 <code>phpfmt<\/code> \u6216 <code>PHP Beautifier<\/code>\uff0c\u7136\u540e\u914d\u7f6e\u5feb\u6377\u952e\u4ee5\u4fbf\u4e8e\u4f7f\u7528\uff0c\u6700\u540e\u6839\u636e\u9700\u8981\u81ea\u5b9a\u4e49\u683c\u5f0f\u5316\u9009\u9879\u4ee5\u7b26\u5408\u4e2a\u4eba\u6216\u56e2\u961f\u4ee3\u7801\u98ce\u683c\u6807\u51c6\u3002\u4e00\u65e6\u8fd9\u4e9b\u6b65\u9aa4\u5b8c\u6210\uff0c\u4fbf\u53ef\u901a\u8fc7\u5feb\u6377\u952e\u5feb\u901f\u5bf9 PHP \u4ee3\u7801\u8fdb\u884c\u6574\u6d01\u3001\u4e00\u81f4\u7684\u683c\u5f0f\u5316\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u5b89\u88c5 PHP \u4ee3\u7801\u683c\u5f0f\u5316\u63d2\u4ef6<\/h3>\n<\/p>\n<p><p>\u8981\u5728 Sublime Text 3 \u4e2d\u683c\u5f0f\u5316 PHP \u4ee3\u7801\uff0c\u9996\u5148\u9700\u8981\u901a\u8fc7\u5176\u5305\u7ba1\u7406\u5668\u5b89\u88c5\u9002\u5408\u7684\u4ee3\u7801\u683c\u5f0f\u5316\u63d2\u4ef6\u3002Sublime Text 3 \u7684\u5305\u7ba1\u7406\u5668\u79f0\u4e3a Package Control\uff0c\u5b83\u4f7f\u5f97\u67e5\u627e\u3001\u5b89\u88c5\u3001\u66f4\u65b0\u548c\u5220\u9664\u63d2\u4ef6\u6210\u4e3a\u53ef\u80fd\u3002<\/p>\n<\/p>\n<p><h4>\u5b89\u88c5 Package Control<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u5c1a\u672a\u5b89\u88c5Package Control\uff0c\u9700\u6309\u4e0b <code>Ctrl+Shift+P<\/code>\uff08Mac \u4e0a\u4e3a <code>Cmd+Shift+P<\/code>\uff09\u4ee5\u6253\u5f00\u547d\u4ee4\u8c03\u8272\u677f\uff0c\u8f93\u5165\u201cInstall Package Control\u201d \u5e76\u6267\u884c\u3002<\/p>\n<\/p>\n<p><h4>\u5b89\u88c5\u63d2\u4ef6<\/h4>\n<\/p>\n<ol>\n<li>\u518d\u6b21\u6309\u4e0b <code>Ctrl+Shift+P<\/code> \u6253\u5f00\u547d\u4ee4\u8c03\u8272\u677f\u3002<\/li>\n<li>\u8f93\u5165\u5e76\u9009\u62e9\u201cPackage Control: Install Package\u201d\u3002<\/li>\n<li>\u5728\u641c\u7d22\u6846\u4e2d\u8f93\u5165 PHP \u683c\u5f0f\u5316\u63d2\u4ef6\u7684\u540d\u79f0\uff0c\u4f8b\u5982<code>phpfmt<\/code>\u6216<code>PHP Beautifier<\/code>\u3002<\/li>\n<li>\u9009\u62e9\u76f8\u5e94\u7684\u63d2\u4ef6\u5e76\u8fdb\u884c\u5b89\u88c5\u3002<\/li>\n<\/ol>\n<p><h3>\u4e8c\u3001\u914d\u7f6e\u5feb\u6377\u952e<\/h3>\n<\/p>\n<p><p>\u5b89\u88c5\u63d2\u4ef6\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u914d\u7f6e\u5feb\u6377\u952e\u6765\u63d0\u9ad8\u683c\u5f0f\u5316\u4ee3\u7801\u7684\u6548\u7387\u3002<\/p>\n<\/p>\n<p><h4>\u8bbe\u7f6e\u5feb\u6377\u952e<\/h4>\n<\/p>\n<ol>\n<li>\u5728 Sublime Text \u4e2d\u9009\u62e9 Preferences &gt; Key Bindings\u3002<\/li>\n<li>\u5728\u6253\u5f00\u7684\u7528\u6237\u81ea\u5b9a\u4e49\u952e\u7ed1\u5b9a\u6587\u4ef6\u4e2d\uff0c\u6dfb\u52a0\u7c7b\u4f3c\u4ee5\u4e0b\u7684\u952e\u7ed1\u5b9a\u4ee3\u7801\uff1a\n<pre><code>{<\/p>\n<p>    &quot;keys&quot;: [&quot;ctrl+alt+f&quot;], <\/p>\n<p>    &quot;command&quot;: &quot;php_beautifier&quot; \/\/ \u6216\u4f7f\u7528 &quot;command&quot;: &quot;phpfmt&quot;<\/p>\n<p>}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u4fdd\u5b58\u5e76\u5173\u95ed\u952e\u7ed1\u5b9a\u6587\u4ef6\u3002<\/li>\n<\/ol>\n<p><h3>\u4e09\u3001\u4f7f\u7528\u5177\u4f53\u7684\u683c\u5f0f\u5316\u8bbe\u7f6e<\/h3>\n<\/p>\n<p><p><strong>\u63d2\u4ef6\u5b89\u88c5\u597d\u540e\uff0c\u4f1a\u6709\u9ed8\u8ba4\u7684\u683c\u5f0f\u5316\u8bbe\u7f6e\uff0c\u4f46\u4e3a\u4e86\u6ee1\u8db3\u4e2a\u4eba\u6216\u56e2\u961f\u7684\u4ee3\u7801\u98ce\u683c\uff0c\u53ef\u80fd\u9700\u8981\u8fdb\u884c\u81ea\u5b9a\u4e49\u8bbe\u7f6e\u3002<\/strong><\/p>\n<\/p>\n<p><h4>\u81ea\u5b9a\u4e49\u683c\u5f0f\u5316<\/h4>\n<\/p>\n<ol>\n<li>\u901a\u5e38\u8fd9\u53ef\u4ee5\u901a\u8fc7\u5728 Preferences \u4e2d\u8bbf\u95ee\u63d2\u4ef6\u7684\u8bbe\u7f6e\uff08&quot;Preferences: Phpfmt Settings &#8211; User&quot; \u6216 &quot;Preferences: PHP Beautifier Settings &#8211; User&quot;\uff09\u6765\u5b8c\u6210\u3002<\/li>\n<li>\u6839\u636e\u63d2\u4ef6\u7684\u6587\u6863\u8c03\u6574\u8bbe\u7f6e\uff0c\u5982\u7f29\u8fdb\u5927\u5c0f\u3001\u82b1\u62ec\u53f7\u4f4d\u7f6e\u7b49\u3002<\/li>\n<\/ol>\n<p><h3>\u56db\u3001\u683c\u5f0f\u5316\u4ee3\u7801\u5b9e\u8df5<\/h3>\n<\/p>\n<p><p>\u6709\u4e86\u4e0a\u8ff0\u51c6\u5907\u4e4b\u540e\uff0c\u5c31\u53ef\u4ee5\u5f00\u59cb\u5bf9 PHP \u4ee3\u7801\u8fdb\u884c\u683c\u5f0f\u5316\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<p><h4>\u6267\u884c\u683c\u5f0f\u5316<\/h4>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u9700\u8981\u683c\u5f0f\u5316\u7684 PHP \u6587\u4ef6\u3002<\/li>\n<li>\u6309\u4e0b\u4e4b\u524d\u914d\u7f6e\u7684\u5feb\u6377\u952e\uff08\u4f8b\u5982<code>Ctrl+Alt+F<\/code>\uff09\u3002<\/li>\n<li>\u63d2\u4ef6\u5c06\u4f1a\u81ea\u52a8\u5bf9\u5f53\u524d\u6587\u4ef6\u8fdb\u884c\u683c\u5f0f\u5316\u3002<\/li>\n<\/ol>\n<p><h4>\u68c0\u67e5\u548c\u8c03\u6574<\/h4>\n<\/p>\n<p><p><strong>\u683c\u5f0f\u5316\u540e\u5982\u679c\u4ee3\u7801\u98ce\u683c\u4ecd\u7136\u4e0d\u7b26\u5408\u9884\u671f\uff0c\u9700\u8981\u56de\u5230\u63d2\u4ef6\u7684\u8bbe\u7f6e\u4e2d\u8fdb\u884c\u8fdb\u4e00\u6b65\u8c03\u6574<\/strong>\u3002\u4e00\u4e9b\u5e38\u89c1\u7684\u8c03\u6574\u9879\u5305\u542b\u6362\u884c\u98ce\u683c\u3001\u7f29\u8fdb\u65b9\u5f0f\u3001\u5b57\u7b26\u4e32\u5f15\u53f7\u7684\u4f7f\u7528\u53ca\u5176\u4ed6\u4ee3\u7801\u4e60\u60ef\u3002\u901a\u8fc7\u591a\u6b21\u8c03\u6574\u548c\u683c\u5f0f\u5316\uff0c\u9010\u6b65\u63a5\u8fd1\u7406\u60f3\u4e2d\u7684\u4ee3\u7801\u98ce\u683c\u3002<\/p>\n<\/p>\n<p><p>\u683c\u5f0f\u5316 PHP \u4ee3\u7801\u662f\u4fdd\u6301\u4ee3\u7801\u6574\u6d01\u3001\u63d0\u5347\u53ef\u7ef4\u62a4\u6027\u7684\u91cd\u8981\u6b65\u9aa4\u3002Sublime Text 3 \u901a\u8fc7\u63d2\u4ef6\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u683c\u5f0f\u5316\u5de5\u5177\uff0c\u901a\u8fc7\u4e0a\u8ff0\u6b65\u9aa4\uff0c\u53ef\u4ee5\u8f7b\u677e\u5b9e\u73b0\u4ee3\u7801\u7684\u683c\u5f0f\u5316\uff0c\u5e76\u6839\u636e\u56e2\u961f\u6807\u51c6\u81ea\u5b9a\u4e49\u98ce\u683c\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>Q: Sublime Text 3\u6709\u4ec0\u4e48\u529f\u80fd\u53ef\u4ee5\u7528\u6765\u683c\u5f0f\u5316PHP\u4ee3\u7801\u5417\uff1f<\/strong><\/p>\n<p>A: Sublime Text 3\u672c\u8eab\u5e76\u4e0d\u81ea\u5e26PHP\u4ee3\u7801\u683c\u5f0f\u5316\u529f\u80fd\uff0c\u4f46\u4f60\u53ef\u4ee5\u901a\u8fc7\u5b89\u88c5\u63d2\u4ef6\u6765\u5b9e\u73b0\u3002\u4f8b\u5982\uff0c\u4f60\u53ef\u4ee5\u5b89\u88c5\u63d2\u4ef6\u50cf&quot;PHP Coding Standards Fixer&quot;\u6216&quot;PHPfmt&quot;\u6765\u683c\u5f0f\u5316\u4f60\u7684PHP\u4ee3\u7801\u3002\u8fd9\u4e9b\u63d2\u4ef6\u53ef\u4ee5\u5e2e\u52a9\u4f60\u81ea\u52a8\u5bf9\u9f50\u4ee3\u7801\u3001\u6dfb\u52a0\u7f29\u8fdb\u3001\u6574\u7406\u7a7a\u884c\u7b49\uff0c\u4ee5\u4fdd\u6301\u4ee3\u7801\u7684\u4e00\u81f4\u6027\u548c\u53ef\u8bfb\u6027\u3002<\/p>\n<p><strong>Q: Sublime Text 3\u5982\u4f55\u5b89\u88c5\u5e76\u4f7f\u7528PHP\u683c\u5f0f\u5316\u63d2\u4ef6\uff1f<\/strong><\/p>\n<p>A: \u8981\u5b89\u88c5PHP\u683c\u5f0f\u5316\u63d2\u4ef6\uff0c\u9996\u5148\u786e\u4fdd\u4f60\u5df2\u7ecf\u5b89\u88c5\u4e86Package Control\uff0c\u8fd9\u662f\u4e00\u4e2a\u7528\u4e8e\u7ba1\u7406Sublime Text\u63d2\u4ef6\u7684\u5de5\u5177\u3002\u5728\u5b89\u88c5\u4e86Package Control\u4e4b\u540e\uff0c\u4f60\u5c31\u53ef\u4ee5\u901a\u8fc7\u5feb\u6377\u952eCtrl+Shift+P\uff08\u6216\u901a\u8fc7\u83dc\u5355Tools -&gt; Command Palette\uff09\u6253\u5f00\u547d\u4ee4\u9762\u677f\u3002\u5728\u547d\u4ee4\u9762\u677f\u4e2d\u8f93\u5165&quot;Install Package&quot;\u5e76\u9009\u62e9\u5bf9\u5e94\u7684\u9009\u9879\uff0c\u7136\u540e\u8f93\u5165\u63d2\u4ef6\u7684\u540d\u79f0\uff0c\u4f8b\u5982&quot;PHP Coding Standards Fixer&quot;\u6216&quot;PHPfmt&quot;\uff0c\u5e76\u6309\u4e0b\u56de\u8f66\u952e\u8fdb\u884c\u5b89\u88c5\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u63d2\u4ef6\u7684\u5feb\u6377\u952e\u6216\u547d\u4ee4\u6765\u5bf9PHP\u4ee3\u7801\u8fdb\u884c\u683c\u5f0f\u5316\u3002<\/p>\n<p><strong>Q: Sublime Text 3\u4e2d\u7684PHP\u683c\u5f0f\u5316\u63d2\u4ef6\u6709\u54ea\u4e9b\u5e38\u7528\u7684\u8bbe\u7f6e\u548c\u9009\u9879\uff1f<\/strong><\/p>\n<p>A: \u4e0d\u540c\u7684PHP\u683c\u5f0f\u5316\u63d2\u4ef6\u53ef\u80fd\u5177\u6709\u4e0d\u540c\u7684\u8bbe\u7f6e\u548c\u9009\u9879\u3002\u4f8b\u5982\uff0c\u4f60\u53ef\u4ee5\u8bbe\u7f6e\u63d2\u4ef6\u5728\u4fdd\u5b58\u6587\u4ef6\u65f6\u81ea\u52a8\u683c\u5f0f\u5316\u4ee3\u7801\u3001\u6307\u5b9aPHP\u7248\u672c\u3001\u9009\u62e9\u4ee3\u7801\u7f29\u8fdb\u6837\u5f0f\uff08\u7a7a\u683c\u6216\u5236\u8868\u7b26\uff09\u3001\u81ea\u5b9a\u4e49\u4ee3\u7801\u5bf9\u9f50\u89c4\u5219\u7b49\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u5728Sublime Text 3\u7684\u9996\u9009\u9879\u4e2d\u627e\u5230\u63d2\u4ef6\u914d\u7f6e\u6587\u4ef6\uff0c\u6839\u636e\u63d2\u4ef6\u7684\u6587\u6863\u8fdb\u884c\u76f8\u5e94\u7684\u8bbe\u7f6e\u3002\u8fd9\u4e9b\u8bbe\u7f6e\u548c\u9009\u9879\u53ef\u4ee5\u5e2e\u52a9\u4f60\u6839\u636e\u4e2a\u4eba\u559c\u597d\u548c\u9879\u76ee\u8981\u6c42\u6765\u5b9a\u5236PHP\u4ee3\u7801\u7684\u683c\u5f0f\u5316\u65b9\u5f0f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Sublime Text 3 \u683c\u5f0f\u5316 PHP \u4ee3\u7801\u4e3b\u8981\u4f9d\u8d56\u4e8e\u63d2\u4ef6\u5b89\u88c5\u3001\u914d\u7f6e\u5feb\u6377\u952e\u3001\u4f7f\u7528\u7279\u5b9a\u7684\u683c\u5f0f\u5316\u8bbe\u7f6e\u3002\u9996\u5148\u9700 [&hellip;]","protected":false},"author":3,"featured_media":223199,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/223183"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=223183"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/223183\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/223199"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=223183"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=223183"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=223183"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}