{"id":25297,"date":"2024-11-21T12:40:19","date_gmt":"2024-11-21T04:40:19","guid":{"rendered":"https:\/\/fwq.ai\/blog\/25297\/"},"modified":"2024-11-21T12:40:19","modified_gmt":"2024-11-21T04:40:19","slug":"thinkphp%e9%a1%b9%e7%9b%ae%e6%80%8e%e4%b9%88%e9%83%a8%e7%bd%b2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/25297\/","title":{"rendered":"thinkphp\u9879\u76ee\u600e\u4e48\u90e8\u7f72"},"content":{"rendered":"<blockquote><p>\n  \u90e8\u7f72 thinkphp \u9879\u76ee\u9700\u8981\uff1a1. \u521b\u5efa\u90e8\u7f72\u76ee\u5f55\uff1b2. \u4e0a\u4f20\u9879\u76ee\u6587\u4ef6\uff1b3. \u914d\u7f6e\u6570\u636e\u5e93\uff1b4. \u8bbe\u7f6e\u5e94\u7528\u6a21\u5f0f\u4e3a\u751f\u4ea7\u6a21\u5f0f\uff1b5. \u8fd0\u884c\u76f8\u5173\u547d\u4ee4\uff1b6. \u521b\u5efa\u865a\u62df\u4e3b\u673a\uff1b7. \u8bbf\u95ee\u9879\u76ee\u3002\u6ce8\u610f\u4e8b\u9879\u5305\u62ec\u8bbe\u7f6e\u9002\u5f53\u6743\u9650\u3001\u6e05\u9664\u6d4f\u89c8\u5668\u7f13\u5b58\u548c\u5b9a\u671f\u5907\u4efd\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202404\/09\/2024040917362575093.jpg\" class=\"aligncenter\" title=\"thinkphp\u9879\u76ee\u600e\u4e48\u90e8\u7f72\u63d2\u56fe\" alt=\"thinkphp\u9879\u76ee\u600e\u4e48\u90e8\u7f72\u63d2\u56fe\" \/><\/p>\n<p><strong>ThinkPHP\u9879\u76ee\u90e8\u7f72\u6307\u5357<\/strong><\/p>\n<p><strong>\u4e00\u3001\u524d\u63d0\u6761\u4ef6<\/strong><\/p>\n<ul>\n<li>\u5df2\u5b8c\u6210ThinkPHP\u9879\u76ee\u7684\u5f00\u53d1\u3002<\/li>\n<li>\u5df2\u914d\u7f6e\u597d\u670d\u52a1\u5668\u73af\u5883\uff08\u5982\uff1aApache\u3001Nginx\uff09\u3002<\/li>\n<li>\u5df2\u83b7\u5f97\u9879\u76ee\u6570\u636e\u5e93\u7684\u8bbf\u95ee\u6743\u9650\u3002<\/li>\n<\/ul>\n<p><strong>\u4e8c\u3001\u9879\u76ee\u90e8\u7f72\u6b65\u9aa4<\/strong><\/p>\n<p><strong>1. \u51c6\u5907\u90e8\u7f72\u76ee\u5f55<\/strong><\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p>\u5728\u670d\u52a1\u5668\u4e0a\u521b\u5efa\u9879\u76ee\u90e8\u7f72\u76ee\u5f55\uff0c\u4f8b\u5982\uff1a\/var\/www\/myproject\u3002<\/p>\n<p><strong>2. \u4e0a\u4f20\u9879\u76ee\u6587\u4ef6<\/strong><\/p>\n<p>\u5c06ThinkPHP\u9879\u76ee\u6587\u4ef6\u4e0a\u4f20\u5230\u90e8\u7f72\u76ee\u5f55\u3002<\/p>\n<p><strong>3. \u914d\u7f6e\u6570\u636e\u5e93<\/strong><\/p>\n<p>\u5728config\/database.php\u6587\u4ef6\u4e2d\u914d\u7f6e\u6570\u636e\u5e93\u8fde\u63a5\u4fe1\u606f\u3002<\/p>\n<p><strong>4. \u8bbe\u7f6e\u5e94\u7528\u6a21\u5f0f<\/strong><\/p>\n<p>\u5728config\/app.php\u6587\u4ef6\u4e2d\uff0c\u5c06&#8217;app_mode&#8217;\u8bbe\u7f6e\u4e3a&#8217;production&#8217;\u4ee5\u542f\u7528\u751f\u4ea7\u6a21\u5f0f\u3002<\/p>\n<p><strong>5. \u8fd0\u884c\u547d\u4ee4<\/strong><\/p>\n<p>\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>composer install\nphp think optimize<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>6. \u521b\u5efa\u865a\u62df\u4e3b\u673a<\/strong><\/p>\n<p>\u5728\u670d\u52a1\u5668\u7684\u865a\u62df\u4e3b\u673a\u914d\u7f6e\u4e2d\uff0c\u914d\u7f6e\u9879\u76ee\u57df\u540d\u548c\u90e8\u7f72\u76ee\u5f55\u7684\u6620\u5c04\u5173\u7cfb\u3002<\/p>\n<p><strong>7. \u8bbf\u95ee\u9879\u76ee<\/strong><\/p>\n<p>\u901a\u8fc7\u9879\u76ee\u57df\u540d\u8bbf\u95ee\u5df2\u90e8\u7f72\u7684\u9879\u76ee\u3002<\/p>\n<p><strong>\u4e09\u3001\u6ce8\u610f\u4e8b\u9879<\/strong><\/p>\n<ul>\n<li>\u786e\u4fdd\u90e8\u7f72\u76ee\u5f55\u5177\u6709\u9002\u5f53\u7684\u6743\u9650\uff08\u5982\uff1awww-data:www-data\uff09\u3002<\/li>\n<li>\u6e05\u9664\u6d4f\u89c8\u5668\u7f13\u5b58\u4ee5\u83b7\u53d6\u6700\u65b0\u7684\u9879\u76ee\u6587\u4ef6\u3002<\/li>\n<li>\u5b9a\u671f\u5907\u4efd\u9879\u76ee\u6587\u4ef6\u4ee5\u9632\u6b62\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u9879\u76ee\u600e\u4e48\u90e8\u7f72\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u90e8\u7f72 thinkphp \u9879\u76ee\u9700\u8981\uff1a1. \u521b\u5efa\u90e8\u7f72\u76ee\u5f55\uff1b2. \u4e0a\u4f20\u9879\u76ee\u6587\u4ef6\uff1b3. \u914d\u7f6e\u6570\u636e\u5e93\uff1b4. \u8bbe\u7f6e\u5e94\u7528\u6a21\u5f0f\u4e3a\u751f\u4ea7\u6a21\u5f0f\uff1b5. \u8fd0\u884c\u76f8\u5173\u547d\u4ee4\uff1b6. \u521b\u5efa\u865a\u62df\u4e3b\u673a\uff1b7. \u8bbf\u95ee\u9879\u76ee\u3002\u6ce8\u610f\u4e8b\u9879\u5305\u62ec\u8bbe\u7f6e\u9002\u5f53\u6743\u9650\u3001\u6e05\u9664\u6d4f\u89c8\u5668\u7f13\u5b58\u548c\u5b9a\u671f\u5907\u4efd\u3002 ThinkPHP\u9879\u76ee\u90e8\u7f72\u6307\u5357 \u4e00\u3001\u524d\u63d0\u6761\u4ef6 \u5df2\u5b8c\u6210ThinkPHP\u9879\u76ee\u7684\u5f00\u53d1\u3002 \u5df2\u914d\u7f6e\u597d\u670d\u52a1\u5668\u73af\u5883\uff08\u5982\uff1aApache\u3001Nginx\uff09\u3002 \u5df2\u83b7\u5f97\u9879\u76ee\u6570\u636e\u5e93\u7684\u8bbf\u95ee\u6743\u9650\u3002 \u4e8c\u3001\u9879\u76ee\u90e8\u7f72\u6b65\u9aa4 1. \u51c6\u5907\u90e8\u7f72\u76ee\u5f55 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u5728\u670d\u52a1\u5668\u4e0a\u521b\u5efa\u9879\u76ee\u90e8\u7f72\u76ee\u5f55\uff0c\u4f8b\u5982\uff1a\/var\/www\/myproject\u3002 2. \u4e0a\u4f20\u9879\u76ee\u6587\u4ef6 \u5c06ThinkPHP\u9879\u76ee\u6587\u4ef6\u4e0a\u4f20\u5230\u90e8\u7f72\u76ee\u5f55\u3002 3. \u914d\u7f6e\u6570\u636e\u5e93 \u5728config\/database.php\u6587\u4ef6\u4e2d\u914d\u7f6e\u6570\u636e\u5e93\u8fde\u63a5\u4fe1\u606f\u3002 4. \u8bbe\u7f6e\u5e94\u7528\u6a21\u5f0f \u5728config\/app.php\u6587\u4ef6\u4e2d\uff0c\u5c06&#8217;app_mode&#8217;\u8bbe\u7f6e\u4e3a&#8217;production&#8217;\u4ee5\u542f\u7528\u751f\u4ea7\u6a21\u5f0f\u3002 5. \u8fd0\u884c\u547d\u4ee4 \u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a composer install php think optimize \u767b\u5f55\u540e\u590d\u5236 6. \u521b\u5efa\u865a\u62df\u4e3b\u673a \u5728\u670d\u52a1\u5668\u7684\u865a\u62df\u4e3b\u673a\u914d\u7f6e\u4e2d\uff0c\u914d\u7f6e\u9879\u76ee\u57df\u540d\u548c\u90e8\u7f72\u76ee\u5f55\u7684\u6620\u5c04\u5173\u7cfb\u3002 7. \u8bbf\u95ee\u9879\u76ee \u901a\u8fc7\u9879\u76ee\u57df\u540d\u8bbf\u95ee\u5df2\u90e8\u7f72\u7684\u9879\u76ee\u3002 \u4e09\u3001\u6ce8\u610f\u4e8b\u9879 \u786e\u4fdd\u90e8\u7f72\u76ee\u5f55\u5177\u6709\u9002\u5f53\u7684\u6743\u9650\uff08\u5982\uff1awww-data:www-data\uff09\u3002 \u6e05\u9664\u6d4f\u89c8\u5668\u7f13\u5b58\u4ee5\u83b7\u53d6\u6700\u65b0\u7684\u9879\u76ee\u6587\u4ef6\u3002 \u5b9a\u671f\u5907\u4efd\u9879\u76ee\u6587\u4ef6\u4ee5\u9632\u6b62\u3002 \u4ee5\u4e0a\u5c31\u662f\u9879\u76ee\u600e\u4e48\u90e8\u7f72\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-25297","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/25297","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=25297"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/25297\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=25297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=25297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=25297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}