{"id":22731,"date":"2024-11-21T12:09:43","date_gmt":"2024-11-21T04:09:43","guid":{"rendered":"https:\/\/fwq.ai\/blog\/22731\/"},"modified":"2024-11-21T12:09:43","modified_gmt":"2024-11-21T04:09:43","slug":"thinkphp%e6%90%ad%e5%bb%ba%e7%8e%af%e5%a2%83","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/22731\/","title":{"rendered":"thinkphp\u642d\u5efa\u73af\u5883"},"content":{"rendered":"<p>thinkphp\u662f\u4e00\u4e2a\u5f00\u6e90\u7684mvc\u6846\u67b6\uff0c\u5b83\u662f\u4ee5php\u8bed\u8a00\u4f5c\u4e3a\u5f00\u53d1\u7684\u57fa\u7840\uff0c\u4ee5\u9762\u5411\u5bf9\u8c61\u7f16\u7a0b\u601d\u60f3\u4e3a\u6307\u5bfc\u601d\u60f3\uff0c\u5c06web\u5e94\u7528\u7a0b\u5e8f\u5f00\u53d1\u53d8\u5f97\u66f4\u52a0\u7b80\u5355\u548c\u9ad8\u6548\u3002\u968f\u7740\u5b83\u7684\u4e0d\u65ad\u53d1\u5c55\u548c\u5b8c\u5584\uff0c\u8d8a\u6765\u8d8a\u591a\u7684\u5f00\u53d1\u8005\u5f00\u59cb\u4f7f\u7528thinkphp\u6765\u6784\u5efa\u81ea\u5df1\u7684web\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<p>\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728Windows\u73af\u5883\u4e0b\u4f7f\u7528XAMPP\u6765\u642d\u5efaThinkPHP\u7684\u5f00\u53d1\u73af\u5883\u3002<\/p>\n<p>\u7b2c\u4e00\u6b65\uff1a\u4e0b\u8f7d\u548c\u5b89\u88c5XAMPP<\/p>\n<p>\u9996\u5148\u9700\u8981\u5230\u5b98\u65b9\u7f51\u7ad9\uff08https:\/\/www.apachefriends.org\/zh_cn\/index.html\uff09\u4e0b\u8f7d\u6700\u65b0\u7248\u672c\u7684XAMPP\uff0c\u5e76\u6309\u7167\u63d0\u793a\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n<p>\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u9700\u8981\u9009\u62e9\u5b89\u88c5PHP\u548cMySQL\u4e24\u4e2a\u7ec4\u4ef6\uff0c\u5e76\u5c06\u5b83\u4eec\u914d\u7f6e\u4e3a\u670d\u52a1\uff0c\u8fd9\u6837\u624d\u80fd\u4fdd\u8bc1\u5728\u547d\u4ee4\u884c\u4e2d\u4f7f\u7528\u3002<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p>\u7b2c\u4e8c\u6b65\uff1a\u4e0b\u8f7d\u548c\u89e3\u538bThinkPHP<\/p>\n<p>\u5728\u5b98\u65b9\u7f51\u7ad9\uff08http:\/\/www.thinkphp.cn\/\uff09\u4e0b\u8f7d\u6700\u65b0\u7248\u672c\u7684ThinkPHP\uff0c\u5e76\u5c06\u5176\u89e3\u538b\u5230XAMPP\u5b89\u88c5\u76ee\u5f55\u4e0b\u7684htdocs\u76ee\u5f55\uff0c\u5982\u56fe\u6240\u793a\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/p9-juejin.byteimg.com\/tos-cn-i-k3u1fbpfcp\/11b3d76f306b43f2b627d50551e5e03d~tplv-k3u1fbpfcp-watermark.image\" class=\"aligncenter\" title=\"thinkphp\u642d\u5efa\u73af\u5883\u63d2\u56fe\" alt=\"thinkphp\u642d\u5efa\u73af\u5883\u63d2\u56fe\" \/><\/p>\n<p>\u7b2c\u4e09\u6b65\uff1a\u914d\u7f6eVirtual Hosts<\/p>\n<p>\u5728XAMPP\u7684\u5b89\u88c5\u76ee\u5f55\u4e0b\u6709\u4e00\u4e2aapacheconfextrahttpd-vhosts.conf\u6587\u4ef6\uff0c\u7528\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00\u8be5\u6587\u4ef6\u5e76\u8fdb\u884c\u5982\u4e0b\u914d\u7f6e\uff1a<\/p>\n<pre>&lt;virtualhost&gt;\n    DocumentRoot \"C:\/xampp\/htdocs\/thinkphp\/public\"\n    ServerName thinkphp.test\n    &lt;directory&gt;\n        Options FollowSymLinks Indexes\n        AllowOverride All\n        Require all granted\n    &lt;\/directory&gt;&lt;\/virtualhost&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4e0a\u9762\u7684\u914d\u7f6e\u5c06\u6211\u4eec\u7684ThinkPHP\u9879\u76ee\u914d\u7f6e\u4e3a\u4e86\u4e00\u4e2aVirtual Hosts\uff0c\u8be5\u914d\u7f6e\u6307\u5b9a\u4e86\u7f51\u7ad9\u7684\u6839\u76ee\u5f55\u548c\u57df\u540d\uff08thinkphp.test\uff09\uff0c\u5e76\u4e14\u8bbe\u7f6e\u4e86.htaccess\u7684\u91cd\u5199\u89c4\u5219\u3002<\/p>\n<p>\u6700\u540e\u5728Windows\u7684hosts\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4e00\u6761\u8bb0\u5f55\u4ee5\u5c06\u8be5\u57df\u540d\u89e3\u6790\u5230\u672c\u673aIP\u5730\u5740\uff1a<\/p>\n<pre>127.0.0.1   thinkphp.test<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7b2c\u56db\u6b65\uff1a\u542f\u52a8Apache\u548cMySQL<\/p>\n<p>\u5728XAMPP\u5b89\u88c5\u76ee\u5f55\u4e0b\u8fd0\u884cxampp-control.exe\uff0c\u542f\u52a8Apache\u548cMySQL\u670d\u52a1\u3002<\/p>\n<p>\u7b2c\u4e94\u6b65\uff1a\u8bbf\u95eeThinkPHP<\/p>\n<p>\u73b0\u5728\u53ef\u4ee5\u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95ee http:\/\/thinkphp.test \u6765\u67e5\u770b\u6211\u4eec\u7684ThinkPHP\u5e94\u7528\u7a0b\u5e8f\u4e86\uff0c\u5982\u56fe\u6240\u793a\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/p3-juejin.byteimg.com\/tos-cn-i-k3u1fbpfcp\/b1f3dd597a9345c99951a11fce470a8d~tplv-k3u1fbpfcp-watermark.image\" class=\"aligncenter\" title=\"thinkphp\u642d\u5efa\u73af\u5883\u63d2\u56fe1\" alt=\"thinkphp\u642d\u5efa\u73af\u5883\u63d2\u56fe1\" \/><\/p>\n<p>\u603b\u7ed3<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u4f7f\u7528XAMPP\u642d\u5efaThinkPHP\u5f00\u53d1\u73af\u5883\u7684\u6b65\u9aa4\u3002\u901a\u8fc7\u5b9e\u8df5\u6211\u4eec\u53ef\u4ee5\u53d1\u73b0\uff0c\u914d\u7f6eVirtual Hosts\u7684\u597d\u5904\u662f\u66f4\u52a0\u7075\u6d3b\uff0c\u53ef\u4ee5\u652f\u6301\u591a\u4e2a\u7ad9\u70b9\u5e76\u4e14\u5728\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u4f7f\u7528\u7edd\u5bf9\u8def\u5f84\u4fbf\u4e8e\u8c03\u8bd5\u3002\u540c\u65f6\u5efa\u8bae\u5728\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u4f7f\u7528Sublime Text\u7b49\u7f16\u8f91\u5668\uff0c\u5e76\u914d\u5408\u4f7f\u7528Composer\u6765\u7ba1\u7406\u4f9d\u8d56\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fthinkphp\u642d\u5efa\u73af\u5883\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\u662f\u4e00\u4e2a\u5f00\u6e90\u7684mvc\u6846\u67b6\uff0c\u5b83\u662f\u4ee5php\u8bed\u8a00\u4f5c\u4e3a\u5f00\u53d1\u7684\u57fa\u7840\uff0c\u4ee5\u9762\u5411\u5bf9\u8c61\u7f16\u7a0b\u601d\u60f3\u4e3a\u6307\u5bfc\u601d\u60f3\uff0c\u5c06web\u5e94\u7528\u7a0b\u5e8f\u5f00\u53d1\u53d8\u5f97\u66f4\u52a0\u7b80\u5355\u548c\u9ad8\u6548\u3002\u968f\u7740\u5b83\u7684\u4e0d\u65ad\u53d1\u5c55\u548c\u5b8c\u5584\uff0c\u8d8a\u6765\u8d8a\u591a\u7684\u5f00\u53d1\u8005\u5f00\u59cb\u4f7f\u7528thinkphp\u6765\u6784\u5efa\u81ea\u5df1\u7684web\u5e94\u7528\u7a0b\u5e8f\u3002 \u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728Windows\u73af\u5883\u4e0b\u4f7f\u7528XAMPP\u6765\u642d\u5efaThinkPHP\u7684\u5f00\u53d1\u73af\u5883\u3002 \u7b2c\u4e00\u6b65\uff1a\u4e0b\u8f7d\u548c\u5b89\u88c5XAMPP \u9996\u5148\u9700\u8981\u5230\u5b98\u65b9\u7f51\u7ad9\uff08https:\/\/www.apachefriends.org\/zh_cn\/index.html\uff09\u4e0b\u8f7d\u6700\u65b0\u7248\u672c\u7684XAMPP\uff0c\u5e76\u6309\u7167\u63d0\u793a\u8fdb\u884c\u5b89\u88c5\u3002 \u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u9700\u8981\u9009\u62e9\u5b89\u88c5PHP\u548cMySQL\u4e24\u4e2a\u7ec4\u4ef6\uff0c\u5e76\u5c06\u5b83\u4eec\u914d\u7f6e\u4e3a\u670d\u52a1\uff0c\u8fd9\u6837\u624d\u80fd\u4fdd\u8bc1\u5728\u547d\u4ee4\u884c\u4e2d\u4f7f\u7528\u3002 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u7b2c\u4e8c\u6b65\uff1a\u4e0b\u8f7d\u548c\u89e3\u538bThinkPHP \u5728\u5b98\u65b9\u7f51\u7ad9\uff08http:\/\/www.thinkphp.cn\/\uff09\u4e0b\u8f7d\u6700\u65b0\u7248\u672c\u7684ThinkPHP\uff0c\u5e76\u5c06\u5176\u89e3\u538b\u5230XAMPP\u5b89\u88c5\u76ee\u5f55\u4e0b\u7684htdocs\u76ee\u5f55\uff0c\u5982\u56fe\u6240\u793a\uff1a \u7b2c\u4e09\u6b65\uff1a\u914d\u7f6eVirtual Hosts \u5728XAMPP\u7684\u5b89\u88c5\u76ee\u5f55\u4e0b\u6709\u4e00\u4e2aapacheconfextrahttpd-vhosts.conf\u6587\u4ef6\uff0c\u7528\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00\u8be5\u6587\u4ef6\u5e76\u8fdb\u884c\u5982\u4e0b\u914d\u7f6e\uff1a &lt;virtualhost&gt; DocumentRoot &#8220;C:\/xampp\/htdocs\/thinkphp\/public&#8221; ServerName thinkphp.test &lt;directory&gt; Options FollowSymLinks Indexes AllowOverride All Require all granted &lt;\/directory&gt;&lt;\/virtualhost&gt; \u767b\u5f55\u540e\u590d\u5236 \u4e0a\u9762\u7684\u914d\u7f6e\u5c06\u6211\u4eec\u7684ThinkPHP\u9879\u76ee\u914d\u7f6e\u4e3a\u4e86\u4e00\u4e2aVirtual Hosts\uff0c\u8be5\u914d\u7f6e\u6307\u5b9a\u4e86\u7f51\u7ad9\u7684\u6839\u76ee\u5f55\u548c\u57df\u540d\uff08thinkphp.test\uff09\uff0c\u5e76\u4e14\u8bbe\u7f6e\u4e86.htaccess\u7684\u91cd\u5199\u89c4\u5219\u3002 \u6700\u540e\u5728Windows\u7684hosts\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4e00\u6761\u8bb0\u5f55\u4ee5\u5c06\u8be5\u57df\u540d\u89e3\u6790\u5230\u672c\u673aIP\u5730\u5740\uff1a 127.0.0.1 thinkphp.test \u767b\u5f55\u540e\u590d\u5236 \u7b2c\u56db\u6b65\uff1a\u542f\u52a8Apache\u548cMySQL \u5728XAMPP\u5b89\u88c5\u76ee\u5f55\u4e0b\u8fd0\u884cxampp-control.exe\uff0c\u542f\u52a8Apache\u548cMySQL\u670d\u52a1\u3002 \u7b2c\u4e94\u6b65\uff1a\u8bbf\u95eeThinkPHP \u73b0\u5728\u53ef\u4ee5\u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95ee http:\/\/thinkphp.test \u6765\u67e5\u770b\u6211\u4eec\u7684ThinkPHP\u5e94\u7528\u7a0b\u5e8f\u4e86\uff0c\u5982\u56fe\u6240\u793a\uff1a \u603b\u7ed3 \u4ee5\u4e0a\u5c31\u662f\u4f7f\u7528XAMPP\u642d\u5efaThinkPHP\u5f00\u53d1\u73af\u5883\u7684\u6b65\u9aa4\u3002\u901a\u8fc7\u5b9e\u8df5\u6211\u4eec\u53ef\u4ee5\u53d1\u73b0\uff0c\u914d\u7f6eVirtual Hosts\u7684\u597d\u5904\u662f\u66f4\u52a0\u7075\u6d3b\uff0c\u53ef\u4ee5\u652f\u6301\u591a\u4e2a\u7ad9\u70b9\u5e76\u4e14\u5728\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u4f7f\u7528\u7edd\u5bf9\u8def\u5f84\u4fbf\u4e8e\u8c03\u8bd5\u3002\u540c\u65f6\u5efa\u8bae\u5728\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u4f7f\u7528Sublime Text\u7b49\u7f16\u8f91\u5668\uff0c\u5e76\u914d\u5408\u4f7f\u7528Composer\u6765\u7ba1\u7406\u4f9d\u8d56\u3002 \u4ee5\u4e0a\u5c31\u662fthinkphp\u642d\u5efa\u73af\u5883\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-22731","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/22731","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=22731"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/22731\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=22731"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=22731"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=22731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}