{"id":25299,"date":"2024-11-21T10:40:21","date_gmt":"2024-11-21T02:40:21","guid":{"rendered":"https:\/\/fwq.ai\/blog\/25299\/"},"modified":"2024-11-21T10:40:21","modified_gmt":"2024-11-21T02:40:21","slug":"thinkphp%e6%80%8e%e4%b9%88%e5%ae%89%e8%a3%85","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/25299\/","title":{"rendered":"thinkphp\u600e\u4e48\u5b89\u88c5"},"content":{"rendered":"<blockquote><p>\n  thinkphp \u5b89\u88c5\u6b65\u9aa4\uff1a\u51c6\u5907 php\u3001composer\u3001mysql \u73af\u5883\u3002\u4f7f\u7528 composer \u521b\u5efa\u9879\u76ee\u3002\u5b89\u88c5 thinkphp \u6846\u67b6\u53ca\u4f9d\u8d56\u9879\u3002\u914d\u7f6e\u6570\u636e\u5e93\u8fde\u63a5\u3002\u751f\u6210\u5e94\u7528\u4ee3\u7801\u3002\u542f\u52a8\u5e94\u7528\u5e76\u8bbf\u95ee http:\/\/localhost:8000\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202404\/09\/2024040917422449264.jpg\" class=\"aligncenter\" title=\"thinkphp\u600e\u4e48\u5b89\u88c5\u63d2\u56fe\" alt=\"thinkphp\u600e\u4e48\u5b89\u88c5\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5b89\u88c5 ThinkPHP<\/strong><\/p>\n<p><strong>\u7b2c\u4e00\u6b65\uff1a\u73af\u5883\u51c6\u5907<\/strong><\/p>\n<p>\u5b89\u88c5 ThinkPHP \u524d\uff0c\u9700\u8981\u6ee1\u8db3\u4ee5\u4e0b\u73af\u5883\u8981\u6c42\uff1a<\/p>\n<ul>\n<li>PHP &gt;= 7.2<\/li>\n<li>Composer &gt;= 2.0<\/li>\n<li>MySQL \u6570\u636e\u5e93<\/li>\n<\/ul>\n<p><strong>\u7b2c\u4e8c\u6b65\uff1a\u521b\u5efa\u9879\u76ee<\/strong><\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p>\u4f7f\u7528 Composer \u521b\u5efa\u4e00\u4e2a\u65b0\u7684 ThinkPHP \u9879\u76ee\uff1a<\/p>\n<pre>composer create-project topthink\/thinkp project-name<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u7b2c\u4e09\u6b65\uff1a\u5b89\u88c5\u4f9d\u8d56<\/strong><\/p>\n<p>\u8fdb\u5165\u9879\u76ee\u76ee\u5f55\uff0c\u5b89\u88c5 ThinkPHP \u6846\u67b6\u548c\u4f9d\u8d56\u9879\uff1a<\/p>\n<pre>cd project-name\ncomposer install<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u7b2c\u56db\u6b65\uff1a\u914d\u7f6e\u6570\u636e\u5e93<\/strong><\/p>\n<p>\u5728 config\/database.php \u6587\u4ef6\u4e2d\u914d\u7f6e\u6570\u636e\u5e93\u8fde\u63a5\uff1a<\/p>\n<pre>return [\n    \/\/ \u6570\u636e\u5e93\u7c7b\u578b\n    'type'        =&gt; 'mysql',\n    \/\/ \u6570\u636e\u5e93\u4e3b\u673a\u540d\n    'hostname'    =&gt; 'localhost',\n    \/\/ \u6570\u636e\u5e93\u7528\u6237\u540d\n    'username'    =&gt; 'root',\n    \/\/ \u6570\u636e\u5e93\u5bc6\u7801\n    'password'    =&gt; 'password',\n    \/\/ \u6570\u636e\u5e93\u540d\n    'database'    =&gt; 'project-name',\n    \/\/ \u6570\u636e\u5e93\u7aef\u53e3\n    'port'        =&gt; 3306,\n];<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u7b2c\u4e94\u6b65\uff1a\u751f\u6210\u5e94\u7528<\/strong><\/p>\n<p>\u8fd0\u884c\u751f\u6210\u5668\u547d\u4ee4\u751f\u6210\u57fa\u672c\u7684\u5e94\u7528\u4ee3\u7801\uff1a<\/p>\n<pre>php think app:generate<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u7b2c\u516d\u6b65\uff1a\u542f\u52a8\u5e94\u7528<\/strong><\/p>\n<p>\u5728\u5f00\u53d1\u73af\u5883\u4e2d\uff0c\u4f7f\u7528\u5185\u7f6e\u7684 WEB \u670d\u52a1\u5668\u542f\u52a8\u5e94\u7528\uff1a<\/p>\n<pre>php think run<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8bbf\u95ee http:\/\/localhost:8000\uff0c\u5373\u53ef\u770b\u5230 ThinkPHP \u5e94\u7528\u7684\u9ed8\u8ba4\u754c\u9762\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u5b89\u88c5\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>thinkphp \u5b89\u88c5\u6b65\u9aa4\uff1a\u51c6\u5907 php\u3001composer\u3001mysql \u73af\u5883\u3002\u4f7f\u7528 composer \u521b\u5efa\u9879\u76ee\u3002\u5b89\u88c5 thinkphp \u6846\u67b6\u53ca\u4f9d\u8d56\u9879\u3002\u914d\u7f6e\u6570\u636e\u5e93\u8fde\u63a5\u3002\u751f\u6210\u5e94\u7528\u4ee3\u7801\u3002\u542f\u52a8\u5e94\u7528\u5e76\u8bbf\u95ee http:\/\/localhost:8000\u3002 \u5982\u4f55\u5b89\u88c5 ThinkPHP \u7b2c\u4e00\u6b65\uff1a\u73af\u5883\u51c6\u5907 \u5b89\u88c5 ThinkPHP \u524d\uff0c\u9700\u8981\u6ee1\u8db3\u4ee5\u4e0b\u73af\u5883\u8981\u6c42\uff1a PHP &gt;= 7.2 Composer &gt;= 2.0 MySQL \u6570\u636e\u5e93 \u7b2c\u4e8c\u6b65\uff1a\u521b\u5efa\u9879\u76ee \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u4f7f\u7528 Composer \u521b\u5efa\u4e00\u4e2a\u65b0\u7684 ThinkPHP \u9879\u76ee\uff1a composer create-project topthink\/thinkp project-name \u767b\u5f55\u540e\u590d\u5236 \u7b2c\u4e09\u6b65\uff1a\u5b89\u88c5\u4f9d\u8d56 \u8fdb\u5165\u9879\u76ee\u76ee\u5f55\uff0c\u5b89\u88c5 ThinkPHP \u6846\u67b6\u548c\u4f9d\u8d56\u9879\uff1a cd project-name composer install \u767b\u5f55\u540e\u590d\u5236 \u7b2c\u56db\u6b65\uff1a\u914d\u7f6e\u6570\u636e\u5e93 \u5728 config\/database.php \u6587\u4ef6\u4e2d\u914d\u7f6e\u6570\u636e\u5e93\u8fde\u63a5\uff1a return [ \/\/ \u6570\u636e\u5e93\u7c7b\u578b &#8216;type&#8217; =&gt; &#8216;mysql&#8217;, [&hellip;]<\/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-25299","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/25299","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=25299"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/25299\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=25299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=25299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=25299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}