{"id":25307,"date":"2024-11-21T14:55:49","date_gmt":"2024-11-21T06:55:49","guid":{"rendered":"https:\/\/fwq.ai\/blog\/25307\/"},"modified":"2024-11-21T14:55:49","modified_gmt":"2024-11-21T06:55:49","slug":"thinkphp%e5%85%a5%e5%8f%a3%e6%96%87%e4%bb%b6%e5%9c%a8%e5%93%aa","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/25307\/","title":{"rendered":"thinkphp\u5165\u53e3\u6587\u4ef6\u5728\u54ea"},"content":{"rendered":"<blockquote><p>\n  thinkphp \u5165\u53e3\u6587\u4ef6\u662f\u6846\u67b6\u542f\u52a8\u65f6\u7b2c\u4e00\u4e2a\u6267\u884c\u7684 php \u6587\u4ef6\uff0c\u4f4d\u4e8e\u9879\u76ee\u6839\u76ee\u5f55\uff0c\u901a\u5e38\u4e3a index.php\u3002\u5b83\u8d1f\u8d23\u521d\u59cb\u5316\u6846\u67b6\u3001\u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6\u5e76\u8def\u7531\u8bf7\u6c42\uff0c\u5305\u542b\u5b9a\u4e49\u6839\u76ee\u5f55\u5e38\u91cf\u3001\u5f15\u5165\u6838\u5fc3\u6587\u4ef6\u3001\u521b\u5efa app \u5b9e\u4f8b\u5e76\u542f\u52a8\u5e94\u7528\u7a0b\u5e8f\u7684\u5185\u5bb9\u3002\u4f5c\u4e3a\u6846\u67b6\u542f\u52a8\u5173\u952e\u90e8\u5206\uff0c\u5165\u53e3\u6587\u4ef6\u8d1f\u8d23\u521d\u59cb\u5316\u73af\u5883\u3001\u52a0\u8f7d\u7c7b\u548c\u8def\u7531\u8bf7\u6c42\uff0c\u6700\u7ec8\u542f\u52a8\u5e94\u7528\u7a0b\u5e8f\u5904\u7406\u8bf7\u6c42\u5e76\u8fd4\u56de\u54cd\u5e94\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202404\/09\/2024040918062379788.jpg\" class=\"aligncenter\" title=\"thinkphp\u5165\u53e3\u6587\u4ef6\u5728\u54ea\u63d2\u56fe\" alt=\"thinkphp\u5165\u53e3\u6587\u4ef6\u5728\u54ea\u63d2\u56fe\" \/><\/p>\n<p><strong>ThinkPHP \u5165\u53e3\u6587\u4ef6<\/strong><\/p>\n<p>ThinkPHP \u5165\u53e3\u6587\u4ef6\u662f\u6846\u67b6\u542f\u52a8\u65f6\u7b2c\u4e00\u4e2a\u6267\u884c\u7684 PHP \u6587\u4ef6\u3002\u5b83\u8d1f\u8d23\u521d\u59cb\u5316\u6846\u67b6\u3001\u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6\u5e76\u8def\u7531\u8bf7\u6c42\u3002<\/p>\n<p><strong>\u5165\u53e3\u6587\u4ef6\u4f4d\u7f6e<\/strong><\/p>\n<p>\u5728 ThinkPHP \u9879\u76ee\u4e2d\uff0c\u5165\u53e3\u6587\u4ef6\u901a\u5e38\u4f4d\u4e8e\u9879\u76ee\u6839\u76ee\u5f55\uff0c\u6587\u4ef6\u540d\u901a\u5e38\u4e3a index.php\u3002<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p><strong>\u5165\u53e3\u6587\u4ef6\u5185\u5bb9<\/strong><\/p>\n<p>\u5165\u53e3\u6587\u4ef6\u4e2d\u5305\u542b\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<ol>\n<li>\u5b9a\u4e49 ThinkPHP \u6839\u76ee\u5f55\u5e38\u91cf THINK_PATH\u3002<\/li>\n<li>\u5f15\u5165 ThinkPHP \u6838\u5fc3\u6587\u4ef6 \/base.php\u3002<\/li>\n<li>\u521b\u5efa hinkApp \u5b9e\u4f8b\u5e76\u542f\u52a8\u5e94\u7528\u7a0b\u5e8f\u3002<\/li>\n<\/ol>\n<p><strong>\u5165\u53e3\u6587\u4ef6\u793a\u4f8b<\/strong><\/p>\n<pre>&lt;?php\n\n\/\/ \u5b9a\u4e49 ThinkPHP \u6839\u76ee\u5f55\u5e38\u91cf\ndefine('THINK_PATH', __DIR__ . '\/thinkphp');\n\n\/\/ \u5f15\u5165 ThinkPHP \u6838\u5fc3\u6587\u4ef6\nrequire THINK_PATH . '\/base.php';\n\n\/\/ \u521b\u5efa \thinkApp \u5b9e\u4f8b\u5e76\u542f\u52a8\u5e94\u7528\u7a0b\u5e8f\n$app = new \thinkApp();\n$app-&gt;run();<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u4f5c\u7528<\/strong><\/p>\n<p>\u5165\u53e3\u6587\u4ef6\u662f ThinkPHP \u6846\u67b6\u542f\u52a8\u8fc7\u7a0b\u4e2d\u7684\u5173\u952e\u90e8\u5206\u3002\u5b83\u8d1f\u8d23\uff1a<\/p>\n<ul>\n<li>\u521d\u59cb\u5316\u6846\u67b6\u73af\u5883\uff0c\u5305\u62ec\u8bbe\u7f6e\u6587\u6863\u6839\u76ee\u5f55\u3001\u5b9a\u4e49\u5e38\u91cf\u548c\u52a0\u8f7d\u914d\u7f6e\u3002<\/li>\n<li>\u52a0\u8f7d\u81ea\u52a8\u52a0\u8f7d\u7c7b\uff0c\u4f7f\u6846\u67b6\u53ca\u5176\u7ec4\u4ef6\u53ef\u4ee5\u88ab\u81ea\u52a8\u52a0\u8f7d\u3002<\/li>\n<li>\u8def\u7531\u8bf7\u6c42\uff0c\u5c06\u8bf7\u6c42\u8f6c\u53d1\u5230\u76f8\u5e94\u7684\u63a7\u5236\u5668\u548c\u64cd\u4f5c\u3002<\/li>\n<li>\u542f\u52a8\u5e94\u7528\u7a0b\u5e8f\uff0c\u5904\u7406\u8bf7\u6c42\u5e76\u8fd4\u56de\u54cd\u5e94\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5165\u53e3\u6587\u4ef6\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 \u5165\u53e3\u6587\u4ef6\u662f\u6846\u67b6\u542f\u52a8\u65f6\u7b2c\u4e00\u4e2a\u6267\u884c\u7684 php \u6587\u4ef6\uff0c\u4f4d\u4e8e\u9879\u76ee\u6839\u76ee\u5f55\uff0c\u901a\u5e38\u4e3a index.php\u3002\u5b83\u8d1f\u8d23\u521d\u59cb\u5316\u6846\u67b6\u3001\u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6\u5e76\u8def\u7531\u8bf7\u6c42\uff0c\u5305\u542b\u5b9a\u4e49\u6839\u76ee\u5f55\u5e38\u91cf\u3001\u5f15\u5165\u6838\u5fc3\u6587\u4ef6\u3001\u521b\u5efa app \u5b9e\u4f8b\u5e76\u542f\u52a8\u5e94\u7528\u7a0b\u5e8f\u7684\u5185\u5bb9\u3002\u4f5c\u4e3a\u6846\u67b6\u542f\u52a8\u5173\u952e\u90e8\u5206\uff0c\u5165\u53e3\u6587\u4ef6\u8d1f\u8d23\u521d\u59cb\u5316\u73af\u5883\u3001\u52a0\u8f7d\u7c7b\u548c\u8def\u7531\u8bf7\u6c42\uff0c\u6700\u7ec8\u542f\u52a8\u5e94\u7528\u7a0b\u5e8f\u5904\u7406\u8bf7\u6c42\u5e76\u8fd4\u56de\u54cd\u5e94\u3002 ThinkPHP \u5165\u53e3\u6587\u4ef6 ThinkPHP \u5165\u53e3\u6587\u4ef6\u662f\u6846\u67b6\u542f\u52a8\u65f6\u7b2c\u4e00\u4e2a\u6267\u884c\u7684 PHP \u6587\u4ef6\u3002\u5b83\u8d1f\u8d23\u521d\u59cb\u5316\u6846\u67b6\u3001\u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6\u5e76\u8def\u7531\u8bf7\u6c42\u3002 \u5165\u53e3\u6587\u4ef6\u4f4d\u7f6e \u5728 ThinkPHP \u9879\u76ee\u4e2d\uff0c\u5165\u53e3\u6587\u4ef6\u901a\u5e38\u4f4d\u4e8e\u9879\u76ee\u6839\u76ee\u5f55\uff0c\u6587\u4ef6\u540d\u901a\u5e38\u4e3a index.php\u3002 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u5165\u53e3\u6587\u4ef6\u5185\u5bb9 \u5165\u53e3\u6587\u4ef6\u4e2d\u5305\u542b\u4ee5\u4e0b\u5185\u5bb9\uff1a \u5b9a\u4e49 ThinkPHP \u6839\u76ee\u5f55\u5e38\u91cf THINK_PATH\u3002 \u5f15\u5165 ThinkPHP \u6838\u5fc3\u6587\u4ef6 \/base.php\u3002 \u521b\u5efa hinkApp \u5b9e\u4f8b\u5e76\u542f\u52a8\u5e94\u7528\u7a0b\u5e8f\u3002 \u5165\u53e3\u6587\u4ef6\u793a\u4f8b &lt;?php \/\/ \u5b9a\u4e49 ThinkPHP \u6839\u76ee\u5f55\u5e38\u91cf define(&#8216;THINK_PATH&#8217;, __DIR__ . &#8216;\/thinkphp&#8217;); \/\/ \u5f15\u5165 ThinkPHP \u6838\u5fc3\u6587\u4ef6 require THINK_PATH . &#8216;\/base.php&#8217;; \/\/ \u521b\u5efa hinkApp \u5b9e\u4f8b\u5e76\u542f\u52a8\u5e94\u7528\u7a0b\u5e8f $app [&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-25307","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/25307","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=25307"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/25307\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=25307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=25307"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=25307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}