{"id":22837,"date":"2024-11-21T13:58:29","date_gmt":"2024-11-21T05:58:29","guid":{"rendered":"https:\/\/fwq.ai\/blog\/22837\/"},"modified":"2024-11-21T13:58:29","modified_gmt":"2024-11-21T05:58:29","slug":"thinkphp-%e9%a6%96%e9%a1%b5%e5%9c%a8%e5%93%aa","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/22837\/","title":{"rendered":"thinkphp \u9996\u9875\u5728\u54ea"},"content":{"rendered":"<p>thinkphp \u9996\u9875\u5728\u54ea<\/p>\n<p>thinkphp\u662f\u4e00\u79cd\u6d41\u884c\u7684php\u6846\u67b6\uff0c\u88ab\u5e7f\u6cdb\u5e94\u7528\u4e8eWeb\u5e94\u7528\u7a0b\u5e8f\u7684\u5f00\u53d1\u4e2d\u3002\u8bb8\u591a\u5f00\u53d1\u4eba\u5458\u9009\u62e9\u4f7f\u7528thinkphp\u6765\u6784\u5efa\u4ed6\u4eec\u7684\u7f51\u7ad9\u548c\u5e94\u7528\u7a0b\u5e8f\uff0c\u56e0\u4e3a\u5b83\u5177\u6709\u5feb\u901f\u3001\u7075\u6d3b\u3001\u5b89\u5168\u3001\u53ef\u9760\u3001\u6613\u7528\u3001\u6613\u7ef4\u62a4\u7b49\u4f18\u52bf\u3002\u7136\u800c\uff0c\u5bf9\u4e8e\u521d\u5b66\u8005\u6216\u65b0\u624b\u800c\u8a00\uff0c\u5bf9\u4e8ethinkphp\u5e94\u7528\u7a0b\u5e8f\u7684\u6587\u4ef6\u7ed3\u6784\u548c\u76ee\u5f55\u7ed3\u6784\u53ef\u80fd\u4f1a\u6709\u4e9b\u6df7\u6dc6\u3002<\/p>\n<p>\u5728thinkphp\u5e94\u7528\u7a0b\u5e8f\u4e2d\uff0c\u627e\u5230\u9996\u9875\u6587\u4ef6\u4f4d\u7f6e\u5f88\u91cd\u8981\u3002\u901a\u5e38\u60c5\u51b5\u4e0b\uff0cthinkphp\u7684\u9996\u9875\u6587\u4ef6\u662f\u4f4d\u4e8e\u516c\u5171\u76ee\u5f55\u7684index.php\u6587\u4ef6\u3002\u5982\u4e0b\u662f\u5728\u9ed8\u8ba4\u60c5\u51b5\u4e0bthinkphp\u5e94\u7528\u7a0b\u5e8f\u4e2d\u7684\u6587\u4ef6\u7ed3\u6784\uff1a<\/p>\n<pre>thinkphp\/\n\u251c\u2500 application\/\n\u2502  \u251c\u2500 common\/\n\u2502  \u251c\u2500 index\/\n\u2502  \u251c\u2500 admin\/\n\u2502  \u251c\u2500 ...\n\u2502  \u2514\u2500 exception\/\n\u2502\n\u251c\u2500 public\/\n\u2502  \u251c\u2500 index.php\n\u2502  \u251c\u2500 ...\n\u2502  \u2514\u2500 .htaccess\n\u2502\n\u251c\u2500 runtime\/\n\u2502\n\u251c\u2500 vendor\/\n\u2502  \u251c\u2500 topthink\/\n\u2502  \u2514\u2500 ... \n\u2502\n\u251c\u2500 thinkphp\/\n\u2502  \u251c\u2500 base.php\n\u2502  \u251c\u2500 console.php\n\u2502  \u251c\u2500 helper.php\n\u2502  \u2514\u2500 ...\n\u2502\n\u251c\u2500 extend.php\n\n\u2514\u2500 composer.json<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728\u4e0a\u9762\u7684\u76ee\u5f55\u7ed3\u6784\u4e2d\uff0cindex.php\u6587\u4ef6\u4f4d\u4e8epublic\u76ee\u5f55\u4e0b\u3002\u5b83\u662f\u5e94\u7528\u7a0b\u5e8f\u7684\u5165\u53e3\u6587\u4ef6\uff0c\u4e5f\u5c31\u662f\u5e94\u7528\u7a0b\u5e8f\u7684\u9996\u9875\u3002\u8fd9\u4e2a\u6587\u4ef6\u5b9a\u4e49\u4e86\u73af\u5883\u53d8\u91cf\u548c\u5f15\u5bfc\u5e94\u7528\u7a0b\u5e8f\u7684\u6267\u884c\u8fc7\u7a0b\u3002\u4e0b\u9762\u662findex.php\u6587\u4ef6\u4ee3\u7801\u7684\u7b80\u5355\u793a\u4f8b\uff1a<\/p>\n<pre>&lt;?php \/\/ \u5b9a\u4e49\u5e94\u7528\u76ee\u5f55\ndefine('APP_PATH', __DIR__ . '\/..\/application\/');\n\n\/\/ \u52a0\u8f7d\u6846\u67b6\u5f15\u5bfc\u6587\u4ef6\nrequire __DIR__ . '\/..\/thinkphp\/start.php';\n\n\/\/ \u6267\u884c\u5e94\u7528\n    hinkApp::run()-&gt;send();<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u8fd9\u4e2a\u6587\u4ef6\u5b9a\u4e49\u4e86APP_PATH\u5e38\u91cf\uff0c\u6307\u5411\u5e94\u7528\u7a0b\u5e8f\u7684\u8def\u5f84\u3002\u7136\u540e\uff0c\u5b83\u5f15\u5165\u4e86\u6846\u67b6\u7684\u5f15\u5bfc\u6587\u4ef6thinkphp\/start.php\uff0c\u5e76\u6267\u884c\u5e94\u7528\u7a0b\u5e8f\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u6d89\u53ca\u5230\u6846\u67b6\u7684\u8def\u7531\u3001\u63a7\u5236\u5668\u548c\u89c6\u56fe\u7b49\u673a\u5236\uff0c\u662fthinkphp\u5e94\u7528\u7a0b\u5e8f\u7684\u6838\u5fc3\u90e8\u5206\u3002<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p>\u867d\u7136thinkphp\u7684\u6587\u4ef6\u7ed3\u6784\u53ef\u80fd\u6709\u4e00\u4e9b\u4e0d\u540c\uff0c\u4f46\u662f\u6211\u4eec\u53ef\u4ee5\u603b\u7ed3\u51fa\u4ee5\u4e0b\u4e00\u4e9b\u901a\u7528\u7684\u89c4\u5219\uff1a<\/p>\n<ol>\n<li>thinkphp\u5e94\u7528\u7a0b\u5e8f\u7684\u5165\u53e3\u6587\u4ef6\u901a\u5e38\u4f4d\u4e8epublic\u76ee\u5f55\u4e0b\u3002<\/li>\n<li>\u5165\u53e3\u6587\u4ef6\u901a\u5e38\u547d\u540d\u4e3aindex.php\u3002<\/li>\n<li>\u5165\u53e3\u6587\u4ef6\u5305\u542b\u4e86\u5e94\u7528\u7a0b\u5e8f\u7684\u73af\u5883\u53d8\u91cf\u548c\u8c03\u7528\u6846\u67b6\u5f15\u5bfc\u6587\u4ef6\u7684\u4ee3\u7801\u3002<\/li>\n<li>\u5e94\u7528\u7a0b\u5e8f\u7684\u8def\u7531\u3001\u63a7\u5236\u5668\u548c\u89c6\u56fe\u7b49\u673a\u5236\u7531\u6846\u67b6\u5f15\u5bfc\u6587\u4ef6\u8d1f\u8d23\u3002<\/li>\n<\/ol>\n<p>\u5728\u5b66\u4e60\u548c\u5f00\u53d1thinkphp\u5e94\u7528\u7a0b\u5e8f\u65f6\uff0c\u6211\u4eec\u9700\u8981\u4e86\u89e3\u8fd9\u4e9b\u89c4\u5219\uff0c\u4ee5\u4fbf\u6b63\u786e\u5730\u7ec4\u7ec7\u548c\u8c03\u7528\u5e94\u7528\u7a0b\u5e8f\u7684\u6587\u4ef6\u3002\u6b64\u5916\uff0c\u6211\u4eec\u8fd8\u9700\u8981\u638c\u63e1thinkphp\u7684\u8def\u7531\u3001\u63a7\u5236\u5668\u548c\u89c6\u56fe\u7b49\u673a\u5236\uff0c\u624d\u80fd\u5feb\u901f\u3001\u7075\u6d3b\u3001\u9ad8\u6548\u5730\u6784\u5efa\u51fa\u9ad8\u8d28\u91cf\u7684Web\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fthinkphp \u9996\u9875\u5728\u54ea\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 \u9996\u9875\u5728\u54ea thinkphp\u662f\u4e00\u79cd\u6d41\u884c\u7684php\u6846\u67b6\uff0c\u88ab\u5e7f\u6cdb\u5e94\u7528\u4e8eWeb\u5e94\u7528\u7a0b\u5e8f\u7684\u5f00\u53d1\u4e2d\u3002\u8bb8\u591a\u5f00\u53d1\u4eba\u5458\u9009\u62e9\u4f7f\u7528thinkphp\u6765\u6784\u5efa\u4ed6\u4eec\u7684\u7f51\u7ad9\u548c\u5e94\u7528\u7a0b\u5e8f\uff0c\u56e0\u4e3a\u5b83\u5177\u6709\u5feb\u901f\u3001\u7075\u6d3b\u3001\u5b89\u5168\u3001\u53ef\u9760\u3001\u6613\u7528\u3001\u6613\u7ef4\u62a4\u7b49\u4f18\u52bf\u3002\u7136\u800c\uff0c\u5bf9\u4e8e\u521d\u5b66\u8005\u6216\u65b0\u624b\u800c\u8a00\uff0c\u5bf9\u4e8ethinkphp\u5e94\u7528\u7a0b\u5e8f\u7684\u6587\u4ef6\u7ed3\u6784\u548c\u76ee\u5f55\u7ed3\u6784\u53ef\u80fd\u4f1a\u6709\u4e9b\u6df7\u6dc6\u3002 \u5728thinkphp\u5e94\u7528\u7a0b\u5e8f\u4e2d\uff0c\u627e\u5230\u9996\u9875\u6587\u4ef6\u4f4d\u7f6e\u5f88\u91cd\u8981\u3002\u901a\u5e38\u60c5\u51b5\u4e0b\uff0cthinkphp\u7684\u9996\u9875\u6587\u4ef6\u662f\u4f4d\u4e8e\u516c\u5171\u76ee\u5f55\u7684index.php\u6587\u4ef6\u3002\u5982\u4e0b\u662f\u5728\u9ed8\u8ba4\u60c5\u51b5\u4e0bthinkphp\u5e94\u7528\u7a0b\u5e8f\u4e2d\u7684\u6587\u4ef6\u7ed3\u6784\uff1a thinkphp\/ \u251c\u2500 application\/ \u2502 \u251c\u2500 common\/ \u2502 \u251c\u2500 index\/ \u2502 \u251c\u2500 admin\/ \u2502 \u251c\u2500 &#8230; \u2502 \u2514\u2500 exception\/ \u2502 \u251c\u2500 public\/ \u2502 \u251c\u2500 index.php \u2502 \u251c\u2500 &#8230; \u2502 \u2514\u2500 .htaccess \u2502 \u251c\u2500 runtime\/ \u2502 \u251c\u2500 vendor\/ \u2502 \u251c\u2500 topthink\/ \u2502 \u2514\u2500 &#8230; \u2502 \u251c\u2500 thinkphp\/ \u2502 \u251c\u2500 base.php \u2502 \u251c\u2500 console.php [&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-22837","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/22837","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=22837"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/22837\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=22837"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=22837"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=22837"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}