{"id":73745,"date":"2024-02-26T10:41:25","date_gmt":"2024-02-26T02:41:25","guid":{"rendered":"https:\/\/docs.pingcode.com\/?p=73745"},"modified":"2024-02-26T10:41:40","modified_gmt":"2024-02-26T02:41:40","slug":"%e7%8e%b0%e5%9c%a8%e8%81%8c%e4%b8%9aphp-%e7%a8%8b%e5%ba%8f%e5%91%98%e9%80%9a%e5%b8%b8%e7%94%a8%e4%bb%80%e4%b9%88%e7%bc%96%e7%a8%8b%e5%b7%a5%e5%85%b7","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/73745.html","title":{"rendered":"\u73b0\u5728\u804c\u4e1aPHP \u7a0b\u5e8f\u5458\u901a\u5e38\u7528\u4ec0\u4e48\u7f16\u7a0b\u5de5\u5177"},"content":{"rendered":"<p style=\"text-align:center;\" ><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-full wp-image-73746\" src=\"https:\/\/cdn-docs.pingcode.com\/wp-content\/uploads\/2024\/02\/img-UCOgHpuHHCTgMe4MDebSbnqO.png?x-oss-process=image\/auto-orient,1\/format,webp\" width=\"600\" height=\"342\" alt=\"\u73b0\u5728\u804c\u4e1aPHP \u7a0b\u5e8f\u5458\u901a\u5e38\u7528\u4ec0\u4e48\u7f16\u7a0b\u5de5\u5177\" \/><\/p>\n<p>\u6807\u9898\uff1a\u73b0\u4ee3\u804c\u4e1aPHP\u7a0b\u5e8f\u5458\u901a\u5e38\u4f7f\u7528\u7684\u7f16\u7a0b\u5de5\u5177<\/p>\n<p><strong>\u5f00\u5934\u6bb5\u843d\uff1a<\/strong><\/p>\n<p>\u73b0\u4ee3\u804c\u4e1aPHP\u7a0b\u5e8f\u5458\u901a\u5e38\u4f7f\u7528\u7684\u7f16\u7a0b\u5de5\u5177\u4e3b\u8981\u5305\u62ec<strong>\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u3001\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u3001\u8c03\u8bd5\u5de5\u5177\u3001\u6570\u636e\u5e93\u7ba1\u7406\u5de5\u5177<\/strong>\u3001\u4ee5\u53ca<strong>\u4ee3\u7801\u8d28\u91cf\u5de5\u5177<\/strong>\u3002\u8fd9\u4e9b\u5de5\u5177\u5171\u540c\u6784\u5efa\u4e86PHP\u5f00\u53d1\u7684\u57fa\u7840\u6846\u67b6\uff0c\u4f7f\u5f00\u53d1\u5de5\u4f5c\u66f4\u52a0\u9ad8\u6548\u3001\u7ec4\u7ec7\u5316\u3002\u7279\u522b\u5730\uff0c<strong>\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09<\/strong>\u65e0\u7591\u662f\u6700\u4e3a\u6838\u5fc3\u7684\u5de5\u5177\u4e4b\u4e00\u3002\u5b83\u4e0d\u4ec5\u63d0\u4f9b\u4e86\u4ee3\u7801\u7f16\u8f91\u3001\u8c03\u8bd5\u3001\u7248\u672c\u63a7\u5236\u7684\u4e00\u4f53\u5316\u89e3\u51b3\u65b9\u6848\uff0c\u800c\u4e14\u8fd8\u652f\u6301\u4ee3\u7801\u81ea\u52a8\u5b8c\u6210\u3001\u8bed\u6cd5\u9ad8\u4eae\u7b49\u529f\u80fd\uff0c\u5927\u5927\u63d0\u9ad8\u4e86\u5f00\u53d1\u6548\u7387\u3002\u4f8b\u5982\uff0cPHPStorm\u548cVisual Studio Code\u7b49IDE\uff0c\u56e0\u5176\u5f3a\u5927\u7684\u529f\u80fd\u548c\u53cb\u597d\u7684\u7528\u6237\u754c\u9762\uff0c\u6210\u4e3a\u4e86\u8bb8\u591aPHP\u7a0b\u5e8f\u5458\u7684\u9996\u9009\u3002<\/p>\n<p><strong>\u6b63\u6587\uff1a<\/strong><\/p>\n<p>### \u4e00\u3001\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09<\/p>\n<p>\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u4e3aPHP\u7a0b\u5e8f\u5458\u63d0\u4f9b\u4e86\u4e00\u4e2a\u529f\u80fd\u4e30\u5bcc\u7684\u5e73\u53f0\uff0c\u4f7f\u5f97\u4ee3\u7801\u7f16\u5199\u3001\u8c03\u8bd5\u548c\u7ba1\u7406\u66f4\u52a0\u4fbf\u6377\u3002<strong>PHPStorm<\/strong>\u662f\u5176\u4e2d\u6700\u53d7\u6b22\u8fce\u7684IDE\u4e4b\u4e00\uff0c\u5b83\u63d0\u4f9b\u4e86\u5bf9PHP\u3001HTML\u3001CSS\u3001JavaScript\u7b49\u591a\u79cd\u8bed\u8a00\u7684\u652f\u6301\u3002PHPStorm\u7684\u5f3a\u5927\u4e4b\u5904\u5728\u4e8e\u5176\u6df1\u5ea6\u7684\u4ee3\u7801\u7406\u89e3\u80fd\u529b\u3001\u4e30\u5bcc\u7684\u8c03\u8bd5\u529f\u80fd\u4ee5\u53ca\u5bf9\u73b0\u4ee3PHP\u6846\u67b6\u7684\u5168\u9762\u652f\u6301\u3002<\/p>\n<p>\u53e6\u4e00\u65b9\u9762\uff0c<strong>Visual Studio Code\uff08VS Code\uff09<\/strong>\uff0c\u4f5c\u4e3a\u4e00\u6b3e\u8f7b\u91cf\u7ea7\u4f46\u529f\u80fd\u5f3a\u5927\u7684\u7f16\u8f91\u5668\uff0c\u4e5f\u53d7\u5230\u4e86\u4f17\u591aPHP\u5f00\u53d1\u8005\u7684\u9752\u7750\u3002VS Code\u901a\u8fc7\u6269\u5c55\u652f\u6301PHP\u5f00\u53d1\uff0c\u63d0\u4f9b\u4e86\u8bed\u6cd5\u9ad8\u4eae\u3001\u4ee3\u7801\u8865\u5168\u3001Git\u96c6\u6210\u7b49\u529f\u80fd\uff0c\u975e\u5e38\u9002\u5408\u8ffd\u6c42\u9ad8\u6548\u7387\u548c\u5b9a\u5236\u6027\u7684\u5f00\u53d1\u4eba\u5458\u3002<\/p>\n<p>### \u4e8c\u3001\u7248\u672c\u63a7\u5236\u7cfb\u7edf<\/p>\n<p>\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u662f\u6bcf\u4e2a\u5f00\u53d1\u9879\u76ee\u4e0d\u53ef\u6216\u7f3a\u7684\u4e00\u90e8\u5206\uff0c<strong>Git<\/strong>\u662f\u76ee\u524d\u6700\u6d41\u884c\u7684\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u3002\u5b83\u4e0d\u4ec5\u5e2e\u52a9\u5f00\u53d1\u8005\u7ba1\u7406\u9879\u76ee\u7684\u4e0d\u540c\u7248\u672c\uff0c\u8fd8\u4fc3\u8fdb\u4e86\u56e2\u961f\u4e4b\u95f4\u7684\u534f\u4f5c\u3002<strong>GitHub<\/strong>\u3001<strong>GitLab<\/strong>\u548c<strong>Bitbucket<\/strong>\u7b49\u5e73\u53f0\uff0c\u901a\u8fc7\u63d0\u4f9b\u5728\u7ebf\u7684\u4ed3\u5e93\u6258\u7ba1\u670d\u52a1\uff0c\u8fdb\u4e00\u6b65\u589e\u5f3a\u4e86Git\u7684\u529f\u80fd\uff0c\u4f7f\u5f97\u4ee3\u7801\u7684\u5206\u4eab\u3001\u5ba1\u67e5\u548c\u7ba1\u7406\u66f4\u4e3a\u9ad8\u6548\u3002<\/p>\n<p>\u7248\u672c\u63a7\u5236\u4e0d\u4ec5\u662f\u4ee3\u7801\u7ba1\u7406\u7684\u57fa\u7840\uff0c\u4e5f\u662f\u5b9e\u73b0\u6301\u7eed\u96c6\u6210\u548c\u6301\u7eed\u90e8\u7f72\uff08<a href=\"https:\/\/docs.pingcode.com\/blog\/devops\/52691.html\" target=\"_blank\">CI\/CD<\/a>\uff09\u7684\u5173\u952e\u7ec4\u4ef6\u3002\u901a\u8fc7\u4f7f\u7528Git\uff0c\u5f00\u53d1\u56e2\u961f\u53ef\u4ee5\u66f4\u5bb9\u6613\u5730\u8ddf\u8e2a\u6bcf\u6b21\u63d0\u4ea4\u7684\u53d8\u66f4\uff0c\u89e3\u51b3\u5408\u5e76\u51b2\u7a81\uff0c\u4ee5\u53ca\u4fdd\u6301\u9879\u76ee\u7684\u7a33\u5b9a\u6027\u548c\u4e00\u81f4\u6027\u3002<\/p>\n<p>### \u4e09\u3001\u8c03\u8bd5\u5de5\u5177<\/p>\n<p>\u5728PHP\u5f00\u53d1\u8fc7\u7a0b\u4e2d\uff0c\u6709\u6548\u7684\u8c03\u8bd5\u662f\u786e\u4fdd\u4ee3\u7801\u8d28\u91cf\u548c\u6027\u80fd\u7684\u5173\u952e\u3002<strong>Xdebug<\/strong>\u662fPHP\u7684\u4e00\u4e2a\u6269\u5c55\uff0c\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u8c03\u8bd5\u529f\u80fd\uff0c\u5982\u65ad\u70b9\u3001\u5806\u6808\u8ddf\u8e2a\u548c\u53d8\u91cf\u76d1\u63a7\u3002\u5b83\u53ef\u4ee5\u4e0e\u591a\u79cdIDE\u96c6\u6210\uff0c\u4f7f\u5f97\u5f00\u53d1\u8005\u80fd\u591f\u76f4\u89c2\u5730\u67e5\u770b\u4ee3\u7801\u6267\u884c\u8fc7\u7a0b\u548c\u8c03\u8bd5\u4fe1\u606f\u3002<\/p>\n<p>\u6b64\u5916\uff0c<strong>PHPUnit<\/strong>\u662f\u4e00\u4e2a\u5355\u5143\u6d4b\u8bd5\u6846\u67b6\uff0c\u5b83\u652f\u6301\u5f00\u53d1\u8005\u901a\u8fc7\u7f16\u5199\u6d4b\u8bd5\u7528\u4f8b\u6765\u9a8c\u8bc1\u4ee3\u7801\u7684\u6b63\u786e\u6027\u3002\u5355\u5143\u6d4b\u8bd5\u4e0d\u4ec5\u53ef\u4ee5\u51cf\u5c11bug\u7684\u6570\u91cf\uff0c\u8fd8\u53ef\u4ee5\u4f5c\u4e3a\u6587\u6863\u4f7f\u7528\uff0c\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u7ef4\u62a4\u6027\u3002<\/p>\n<p>### \u56db\u3001\u6570\u636e\u5e93\u7ba1\u7406\u5de5\u5177<\/p>\n<p>\u5bf9\u4e8e\u4efb\u4f55\u9700\u8981\u6301\u4e45\u5316\u6570\u636e\u5b58\u50a8\u7684PHP\u5e94\u7528\u6765\u8bf4\uff0c\u6709\u6548\u7684\u6570\u636e\u5e93\u7ba1\u7406\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\u3002<strong>PhpMyAdmin<\/strong>\u662f\u4e00\u4e2a\u6d41\u884c\u7684MySQL\u6570\u636e\u5e93\u7ba1\u7406\u5de5\u5177\uff0c\u5b83\u63d0\u4f9b\u4e86\u4e00\u4e2a\u57fa\u4e8eWeb\u7684\u7528\u6237\u754c\u9762\u6765\u6267\u884c\u6570\u636e\u5e93\u64cd\u4f5c\uff0c\u5982\u67e5\u8be2\u3001\u521b\u5efa\u6570\u636e\u8868\u3001\u7ba1\u7406\u6570\u636e\u5e93\u7528\u6237\u7b49\u3002<\/p>\n<p>\u53e6\u4e00\u4e2a\u503c\u5f97\u63d0\u53ca\u7684\u5de5\u5177\u662f<strong>Doctrine<\/strong>\uff0c\u8fd9\u662f\u4e00\u4e2a\u670d\u52a1\u4e8ePHP\u7684\u5bf9\u8c61<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>1. \u6709\u54ea\u4e9b\u6d41\u884c\u7684\u7f16\u7a0b\u5de5\u5177\u9002\u5408\u804c\u4e1aPHP\u7a0b\u5e8f\u5458\u4f7f\u7528\uff1f<\/strong><\/p>\n<p>\u804c\u4e1aPHP\u7a0b\u5e8f\u5458\u901a\u5e38\u4f1a\u9009\u62e9\u4e00\u4e9b\u6d41\u884c\u7684\u7f16\u7a0b\u5de5\u5177\u6765\u63d0\u9ad8\u4ed6\u4eec\u7684\u5f00\u53d1\u6548\u7387\u548c\u4ee3\u7801\u8d28\u91cf\u3002\u5176\u4e2d\uff0c\u4e00\u6b3e\u5e7f\u53d7\u597d\u8bc4\u7684\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u662fPHPStorm\uff0c\u5b83\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u529f\u80fd\uff0c\u5982\u4ee3\u7801\u81ea\u52a8\u8865\u5168\u3001\u8c03\u8bd5\u548c\u7248\u672c\u63a7\u5236\u7b49\u3002\u53e6\u5916\uff0cSublime Text\u3001Visual Studio Code\u548cAtom\u7b49\u8f7b\u91cf\u7ea7\u6587\u672c\u7f16\u8f91\u5668\u4e5f\u662f\u4e0d\u5c11PHP\u7a0b\u5e8f\u5458\u7684\u9009\u62e9\uff0c\u56e0\u4e3a\u5b83\u4eec\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u63d2\u4ef6\u548c\u5b9a\u5236\u529f\u80fd\u3002\u5bf9\u4e8e\u56e2\u961f\u5408\u4f5c\u5f00\u53d1\u800c\u8a00\uff0cGit\u548cGitHub\u7b49\u7248\u672c\u63a7\u5236\u5de5\u5177\u4e5f\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\uff0c\u5b83\u4eec\u80fd\u591f\u5e2e\u52a9\u7a0b\u5e8f\u5458\u9ad8\u6548\u5730\u7ba1\u7406\u548c\u5206\u4eab\u4ee3\u7801\u3002<\/p>\n<p><strong>2. \u5728PHP\u5f00\u53d1\u4e2d\uff0c\u54ea\u4e9b\u7f16\u7a0b\u5de5\u5177\u53ef\u4ee5\u5e2e\u52a9\u7a0b\u5e8f\u5458\u63d0\u9ad8\u4ee3\u7801\u8d28\u91cf\uff1f<\/strong><\/p>\n<p>\u4e3a\u4e86\u4fdd\u8bc1\u4ee3\u7801\u7684\u8d28\u91cf\u548c\u7a33\u5b9a\u6027\uff0c\u804c\u4e1aPHP\u7a0b\u5e8f\u5458\u901a\u5e38\u4f1a\u91c7\u7528\u4e00\u4e9b\u4e13\u95e8\u7684\u7f16\u7a0b\u5de5\u5177\u6765\u8f85\u52a9\u5f00\u53d1\u3002PHP_CodeSniffer\u662f\u4e00\u6b3e\u6d41\u884c\u7684\u5de5\u5177\uff0c\u80fd\u591f\u5e2e\u52a9\u7a0b\u5e8f\u5458\u68c0\u67e5\u4ee3\u7801\u7b26\u5408PSR\u6807\u51c6\uff0c\u63d0\u9ad8\u4ee3\u7801\u7684\u4e00\u81f4\u6027\u548c\u53ef\u8bfb\u6027\u3002\u53e6\u5916\uff0cPHPStan\u548cPsalm\u7b49\u9759\u6001\u5206\u6790\u5de5\u5177\u53ef\u4ee5\u5e2e\u52a9\u7a0b\u5e8f\u5458\u53d1\u73b0\u6f5c\u5728\u7684bug\u548c\u7c7b\u578b\u4e0d\u4e00\u81f4\u95ee\u9898\u3002\u6b64\u5916\uff0cPHPUnit\u662f\u4e00\u4e2a\u5e38\u7528\u7684\u5355\u5143\u6d4b\u8bd5\u5de5\u5177\uff0c\u53ef\u4ee5\u5e2e\u52a9\u7a0b\u5e8f\u5458\u7f16\u5199\u548c\u8fd0\u884c\u6d4b\u8bd5\u7528\u4f8b\uff0c\u4fdd\u8bc1\u4ee3\u7801\u7684\u7a33\u5b9a\u6027\u548c\u53ef\u9760\u6027\u3002<\/p>\n<p><strong>3. PHP\u7a0b\u5e8f\u5458\u5982\u4f55\u9009\u62e9\u9002\u5408\u81ea\u5df1\u7684\u7f16\u7a0b\u5de5\u5177\uff1f<\/strong><\/p>\n<p>\u5bf9\u4e8e\u804c\u4e1aPHP\u7a0b\u5e8f\u5458\u6765\u8bf4\uff0c\u9009\u62e9\u5408\u9002\u7684\u7f16\u7a0b\u5de5\u5177\u662f\u975e\u5e38\u91cd\u8981\u7684\uff0c\u80fd\u591f\u63d0\u9ad8\u5de5\u4f5c\u6548\u7387\u548c\u4ee3\u7801\u8d28\u91cf\u3002\u5728\u9009\u62e9\u5de5\u5177\u65f6\uff0c\u9996\u5148\u9700\u8981\u8003\u8651\u81ea\u5df1\u7684\u5f00\u53d1\u4e60\u60ef\u548c\u9700\u6c42\uff0c\u6bd4\u5982\u559c\u6b22\u4f7f\u7528\u96c6\u6210\u5f00\u53d1\u73af\u5883\u8fd8\u662f\u6587\u672c\u7f16\u8f91\u5668\uff0c\u4ee5\u53ca\u9700\u8981\u54ea\u4e9b\u7279\u5b9a\u7684\u529f\u80fd\u548c\u63d2\u4ef6\u3002\u5176\u6b21\uff0c\u53ef\u4ee5\u53c2\u8003\u5176\u4ed6\u7a0b\u5e8f\u5458\u7684\u63a8\u8350\u548c\u8bc4\u4ef7\uff0c\u4e86\u89e3\u5404\u79cd\u5de5\u5177\u7684\u4f18\u7f3a\u70b9\u3002\u6700\u540e\uff0c\u901a\u8fc7\u5c1d\u8bd5\u548c\u5b9e\u8df5\uff0c\u9010\u6e10\u638c\u63e1\u548c\u719f\u6089\u9009\u62e9\u7684\u5de5\u5177\uff0c\u4e0d\u65ad\u4f18\u5316\u548c\u8c03\u6574\u914d\u7f6e\uff0c\u4ee5\u63d0\u5347\u81ea\u5df1\u7684\u5f00\u53d1\u6280\u80fd\u548c\u6c34\u5e73\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u6807\u9898\uff1a\u73b0\u4ee3\u804c\u4e1aPHP\u7a0b\u5e8f\u5458\u901a\u5e38\u4f7f\u7528\u7684\u7f16\u7a0b\u5de5\u5177 \u5f00\u5934\u6bb5\u843d\uff1a \u73b0\u4ee3\u804c\u4e1aPHP\u7a0b\u5e8f\u5458\u901a\u5e38\u4f7f\u7528\u7684\u7f16\u7a0b\u5de5\u5177\u4e3b\u8981\u5305\u62ec\u96c6\u6210\u5f00 [&hellip;]","protected":false},"author":1,"featured_media":73748,"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\/73745"}],"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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=73745"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/73745\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/73748"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=73745"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=73745"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=73745"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}