{"id":23002,"date":"2024-11-21T08:41:08","date_gmt":"2024-11-21T00:41:08","guid":{"rendered":"https:\/\/fwq.ai\/blog\/23002\/"},"modified":"2024-11-21T08:41:08","modified_gmt":"2024-11-21T00:41:08","slug":"thinkphp5%e5%92%8cci%e5%93%aa%e4%b8%aa%e5%a5%bd","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/23002\/","title":{"rendered":"thinkphp5\u548cci\u54ea\u4e2a\u597d"},"content":{"rendered":"<p>\u8fd1\u5e74\u6765\uff0c\u968f\u7740\u4e92\u8054\u7f51\u7684\u8fc5\u731b\u53d1\u5c55\uff0c\u5404\u79cd\u7f51\u7ad9\u548c\u5e94\u7528\u5c42\u51fa\u4e0d\u7a77\uff0c\u8ba9\u4eba\u773c\u82b1\u7f2d\u4e71\u3002\u5728\u8fd9\u4e9b\u5e94\u7528\u4e2d\uff0c\u7f51\u7ad9\u540e\u53f0\u7ba1\u7406\u662f\u4e00\u4e2a\u4e0d\u53ef\u6216\u7f3a\u7684\u90e8\u5206\uff0c\u800c thinkphp 5 \u548c codeigniter (ci) \u662f\u5e38\u89c1\u7684\u540e\u53f0\u5f00\u53d1\u6846\u67b6\u3002\u90a3\u4e48\uff0c\u8fd9\u4e24\u4e2a\u6846\u67b6\u54ea\u4e2a\u66f4\u597d\uff1f\u8fd9\u662f\u4e00\u4e2a\u503c\u5f97\u8ba8\u8bba\u7684\u8bdd\u9898\u3002<\/p>\n<p>\u4e00\u3001\u6846\u67b6\u7b80\u4ecb<\/p>\n<p>1.1 ThinkPHP 5<br \/>ThinkPHP 5 \u662f\u4e00\u4e2a\u57fa\u4e8e PHP \u8bed\u8a00\u7684\u5f00\u6e90 Web \u5e94\u7528\u5f00\u53d1\u6846\u67b6\u3002\u5b83\u9075\u5faa MVC \u67b6\u6784\u6a21\u5f0f\uff0c\u5177\u6709\u7b80\u5355\u3001\u9ad8\u6548\u3001\u7075\u6d3b\u7b49\u4f18\u70b9\u3002ThinkPHP 5 \u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u5de5\u5177\u548c\u6269\u5c55\u5e93\uff0c\u6781\u5927\u5730\u964d\u4f4e\u4e86\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u7684\u590d\u6742\u6027\u3002<\/p>\n<p>1.2 CodeIgniter (CI)<br \/>CodeIgniter \u662f\u53e6\u4e00\u4e2a\u5e38\u7528\u7684 PHP \u5f00\u53d1\u6846\u67b6\uff0c\u5b83\u88ab\u79f0\u4e3a\u201c\u4e24\u5757\u7816\u5934\u7684\u6846\u67b6\u201d\uff0c\u56e0\u4e3a\u5b83\u53ea\u9700\u8981\u4e00\u4e9b\u57fa\u672c\u7684\u77e5\u8bc6\u548c\u5c11\u91cf\u7684\u4ee3\u7801\u5c31\u53ef\u4ee5\u5efa\u7acb\u4e00\u4e2a\u7f51\u7ad9\u3002CI \u8f7b\u91cf\u7ea7\u3001\u7b80\u5355\u6613\u5b66\u3001\u901f\u5ea6\u5feb\uff0c\u5bf9\u4e8e\u5c0f\u578b Web \u5e94\u7528\u7a0b\u5e8f\u7684\u5f00\u53d1\u975e\u5e38\u9002\u5408\u3002<\/p>\n<p>\u4e8c\u3001\u6027\u80fd\u6bd4\u8f83<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p>2.1 \u6027\u80fd\u65b9\u9762\u7684\u6bd4\u8f83<br \/>\u5728\u6027\u80fd\u65b9\u9762\uff0cThinkPHP 5 \u7684\u6027\u80fd\u4f18\u4e8e CI\u3002\u636e\u6d4b\u8bd5\u6570\u636e\u663e\u793a\uff0cThinkPHP 5 \u7684\u901f\u5ea6\u6bd4 CI \u5feb 2 \u500d\u4ee5\u4e0a\u3002\u8fd9\u662f\u56e0\u4e3a ThinkPHP 5 \u7684\u8fd0\u884c\u6548\u7387\u66f4\u9ad8\uff0c\u4f7f\u7528\u4e86\u66f4\u5148\u8fdb\u7684\u4ee3\u7801\u4f18\u5316\u6280\u672f\u3002CI \u5728\u5c0f\u578b\u5e94\u7528\u4e2d\u8868\u73b0\u826f\u597d\uff0c\u4f46\u6570\u91cf\u5e9e\u5927\u7684\u5f00\u6e90\u793e\u533a\u4e5f\u672a\u80fd\u4e3a CI \u5e26\u6765\u65e0\u61c8\u53ef\u51fb\u7684\u6027\u80fd\u8868\u73b0\u3002<\/p>\n<p>2.2 \u6570\u636e\u6027\u80fd\u7684\u6bd4\u8f83<br \/>\u5728\u5904\u7406\u5927\u91cf\u6570\u636e\u65f6\uff0cThinkPHP 5 \u548c CI \u7684\u5904\u7406\u65b9\u5f0f\u6709\u6240\u4e0d\u540c\u3002ThinkPHP 5 \u4f7f\u7528\u4e86\u66f4\u5148\u8fdb\u7684\u6570\u636e\u5e93\u8fde\u63a5\u6280\u672f\uff0c\u53ef\u4ee5\u66f4\u9ad8\u6548\u5730\u5904\u7406\u5927\u91cf\u6570\u636e\uff0c\u800c CI \u7684\u5904\u7406\u65b9\u5f0f\u76f8\u5bf9\u6765\u8bf4\u8f83\u4e3a\u7b80\u5355\u3002<\/p>\n<p>2.3 \u51cf\u5c11\u52a0\u8f7d\u65f6\u95f4\u7684\u6bd4\u8f83<br \/>\u5728\u8bbf\u95ee\u901f\u5ea6\u65b9\u9762\uff0cThinkPHP 5 \u5bf9\u4e8e\u5927\u578b\u7684\u5e94\u7528\uff0c\u51cf\u5c11\u52a0\u8f7d\u65f6\u95f4\u7684\u6548\u679c\u6bd4 CI \u66f4\u597d\u3002\u5f53\u7136\uff0c\u5bf9\u4e8e\u5c0f\u578b\u7684\u5e94\u7528\uff0cCI \u5904\u7406\u5feb\u901f\uff0c\u4f1a\u8ba9\u9875\u9762\u66f4\u5feb\u5730\u52a0\u8f7d\u51fa\u6765\u3002<\/p>\n<p>\u4e09\u3001\u5f00\u53d1\u548c\u4f7f\u7528<\/p>\n<p>3.1 \u5f00\u53d1\u6846\u67b6\u7684\u7a33\u5b9a\u6027<br \/>ThinkPHP 5 \u548c CI \u90fd\u662f\u529f\u80fd\u7a33\u5b9a\u7684\u5f00\u53d1\u6846\u67b6\uff0c\u5e76\u4e14\u6709\u7740\u5f3a\u5927\u7684\u5e94\u7528\u7a0b\u5e8f\u529f\u80fd\u3002\u5728\u4f7f\u7528\u8fd9\u4e24\u79cd\u6846\u67b6\u8fdb\u884c\u5f00\u53d1\u65f6\uff0c\u4f60\u53ef\u4ee5\u5728\u8fd9\u4e2a\u57fa\u7840\u4e0a\u521b\u9020\u81ea\u5df1\u7684\u5e94\u7528\u3002\u65e0\u8bba\u662f\u54ea\u79cd\u6846\u67b6\uff0c\u5f00\u53d1\u8005\u90fd\u53ef\u4ee5\u8f7b\u677e\u8fdb\u884c\u5f00\u53d1\u3002<\/p>\n<p>3.2 \u4f7f\u7528\u96be\u5ea6\u7684\u6bd4\u8f83<br \/>ThinkPHP 5 \u7684\u4f7f\u7528\u96be\u5ea6\u7a0d\u9ad8\u4e8e CI\uff0c\u9700\u8981\u5177\u5907\u4e00\u5b9a\u7684 PHP \u57fa\u7840\u548c MVC \u67b6\u6784\u7684\u4e86\u89e3\u3002CI \u5219\u76f8\u5bf9\u66f4\u52a0\u5bb9\u6613\u4e0a\u624b\uff0c\u56e0\u4e3a\u5b83\u4e0d\u9700\u8981\u989d\u5916\u7684\u90e8\u7f72\u6b65\u9aa4\u5e76\u4e14\u4f7f\u7528\u7b80\u5355\u3002<\/p>\n<p>3.3 \u6269\u5c55\u6027\u6bd4\u8f83<br \/>\u5728\u6269\u5c55\u65b9\u9762\uff0cThinkPHP 5 \u6bd4 CI \u66f4\u4e3a\u5f3a\u5927\u3002\u5b83\u7684\u6269\u5c55\u5e93\u66f4\u52a0\u4e30\u5bcc\uff0c\u800c\u4e14\u5927\u591a\u6570\u5e38\u89c1\u7684\u529f\u80fd\u90fd\u5185\u7f6e\u5728\u6838\u5fc3\u6846\u67b6\u4e2d\u3002CI \u63d0\u4f9b\u4e86\u8bb8\u591a\u63d2\u4ef6\u548c\u6269\u5c55\uff0c\u4f46\u8d44\u6e90\u5e76\u4e0d\u5982 ThinkPHP 5 \u90a3\u6837\u5b8c\u5584\u548c\u6210\u719f\u3002<\/p>\n<p>\u56db\u3001\u603b\u7ed3<\/p>\n<p>\u603b\u7684\u6765\u8bf4\uff0cThinkPHP 5 \u548c CI \u90fd\u662f\u975e\u5e38\u597d\u7684 PHP \u5f00\u53d1\u6846\u67b6\uff0c\u9009\u62e9\u54ea\u4e2a\u6846\u67b6\u4e3b\u8981\u53d6\u51b3\u4e8e\u5b9e\u9645\u9700\u8981\u3002\u5982\u679c\u662f\u5c0f\u578b\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u53ef\u4ee5\u4f7f\u7528 CI\uff1b\u5982\u679c\u662f\u5927\u578b\u7684\u9879\u76ee\uff0cThinkPHP 5 \u53ef\u4ee5\u66f4\u597d\u5730\u652f\u6301\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u5bf9\u4e8e\u5177\u6709\u4e00\u5b9a PHP \u57fa\u7840\u548c MVC \u67b6\u6784\u77e5\u8bc6\u7684\u4eba\u6765\u8bf4\uff0cThinkPHP 5 \u66f4\u5177\u6269\u5c55\u6027\uff0c\u800c\u5bf9\u4e8e\u521d\u5b66\u8005\u6765\u8bf4\uff0cCI \u66f4\u5bb9\u6613\u4e0a\u624b\u3002<\/p>\n<p>\u7efc\u4e0a\uff0cthinkphp5 \u548c ci \u90fd\u6709\u5404\u81ea\u7684\u4f18\u52bf\u548c\u9002\u7528\u573a\u666f\uff0c\u800c\u9009\u62e9\u54ea\u4e2a\u53d6\u51b3\u4e8e\u5b9e\u9645\u9700\u6c42\u3002\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u6280\u672f\u6c34\u5e73\u548c\u9879\u76ee\u9700\u8981\u6765\u9009\u62e9\u5408\u9002\u7684\u6846\u67b6\uff0c\u4ee5\u4fbf\u66f4\u9ad8\u6548\u5730\u8fdb\u884c\u5f00\u53d1\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fthinkphp5\u548cci\u54ea\u4e2a\u597d\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>\u8fd1\u5e74\u6765\uff0c\u968f\u7740\u4e92\u8054\u7f51\u7684\u8fc5\u731b\u53d1\u5c55\uff0c\u5404\u79cd\u7f51\u7ad9\u548c\u5e94\u7528\u5c42\u51fa\u4e0d\u7a77\uff0c\u8ba9\u4eba\u773c\u82b1\u7f2d\u4e71\u3002\u5728\u8fd9\u4e9b\u5e94\u7528\u4e2d\uff0c\u7f51\u7ad9\u540e\u53f0\u7ba1\u7406\u662f\u4e00\u4e2a\u4e0d\u53ef\u6216\u7f3a\u7684\u90e8\u5206\uff0c\u800c thinkphp 5 \u548c codeigniter (ci) \u662f\u5e38\u89c1\u7684\u540e\u53f0\u5f00\u53d1\u6846\u67b6\u3002\u90a3\u4e48\uff0c\u8fd9\u4e24\u4e2a\u6846\u67b6\u54ea\u4e2a\u66f4\u597d\uff1f\u8fd9\u662f\u4e00\u4e2a\u503c\u5f97\u8ba8\u8bba\u7684\u8bdd\u9898\u3002 \u4e00\u3001\u6846\u67b6\u7b80\u4ecb 1.1 ThinkPHP 5ThinkPHP 5 \u662f\u4e00\u4e2a\u57fa\u4e8e PHP \u8bed\u8a00\u7684\u5f00\u6e90 Web \u5e94\u7528\u5f00\u53d1\u6846\u67b6\u3002\u5b83\u9075\u5faa MVC \u67b6\u6784\u6a21\u5f0f\uff0c\u5177\u6709\u7b80\u5355\u3001\u9ad8\u6548\u3001\u7075\u6d3b\u7b49\u4f18\u70b9\u3002ThinkPHP 5 \u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u5de5\u5177\u548c\u6269\u5c55\u5e93\uff0c\u6781\u5927\u5730\u964d\u4f4e\u4e86\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u7684\u590d\u6742\u6027\u3002 1.2 CodeIgniter (CI)CodeIgniter \u662f\u53e6\u4e00\u4e2a\u5e38\u7528\u7684 PHP \u5f00\u53d1\u6846\u67b6\uff0c\u5b83\u88ab\u79f0\u4e3a\u201c\u4e24\u5757\u7816\u5934\u7684\u6846\u67b6\u201d\uff0c\u56e0\u4e3a\u5b83\u53ea\u9700\u8981\u4e00\u4e9b\u57fa\u672c\u7684\u77e5\u8bc6\u548c\u5c11\u91cf\u7684\u4ee3\u7801\u5c31\u53ef\u4ee5\u5efa\u7acb\u4e00\u4e2a\u7f51\u7ad9\u3002CI \u8f7b\u91cf\u7ea7\u3001\u7b80\u5355\u6613\u5b66\u3001\u901f\u5ea6\u5feb\uff0c\u5bf9\u4e8e\u5c0f\u578b Web \u5e94\u7528\u7a0b\u5e8f\u7684\u5f00\u53d1\u975e\u5e38\u9002\u5408\u3002 \u4e8c\u3001\u6027\u80fd\u6bd4\u8f83 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b 2.1 \u6027\u80fd\u65b9\u9762\u7684\u6bd4\u8f83\u5728\u6027\u80fd\u65b9\u9762\uff0cThinkPHP 5 \u7684\u6027\u80fd\u4f18\u4e8e CI\u3002\u636e\u6d4b\u8bd5\u6570\u636e\u663e\u793a\uff0cThinkPHP 5 \u7684\u901f\u5ea6\u6bd4 CI \u5feb 2 \u500d\u4ee5\u4e0a\u3002\u8fd9\u662f\u56e0\u4e3a ThinkPHP 5 \u7684\u8fd0\u884c\u6548\u7387\u66f4\u9ad8\uff0c\u4f7f\u7528\u4e86\u66f4\u5148\u8fdb\u7684\u4ee3\u7801\u4f18\u5316\u6280\u672f\u3002CI \u5728\u5c0f\u578b\u5e94\u7528\u4e2d\u8868\u73b0\u826f\u597d\uff0c\u4f46\u6570\u91cf\u5e9e\u5927\u7684\u5f00\u6e90\u793e\u533a\u4e5f\u672a\u80fd\u4e3a CI \u5e26\u6765\u65e0\u61c8\u53ef\u51fb\u7684\u6027\u80fd\u8868\u73b0\u3002 2.2 \u6570\u636e\u6027\u80fd\u7684\u6bd4\u8f83\u5728\u5904\u7406\u5927\u91cf\u6570\u636e\u65f6\uff0cThinkPHP 5 \u548c CI \u7684\u5904\u7406\u65b9\u5f0f\u6709\u6240\u4e0d\u540c\u3002ThinkPHP [&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-23002","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/23002","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=23002"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/23002\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=23002"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=23002"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=23002"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}