{"id":183990,"date":"2024-05-08T21:57:39","date_gmt":"2024-05-08T13:57:39","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/183990.html"},"modified":"2024-05-08T21:57:47","modified_gmt":"2024-05-08T13:57:47","slug":"thinkphp-3-1-2%e6%98%af%e5%90%a6%e6%94%af%e6%8c%81php7-0","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/183990.html","title":{"rendered":"thinkphp 3.1.2\u662f\u5426\u652f\u6301PHP7.0"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/27074915\/2f59efad-1cfc-4b0d-a73b-3c3d5c776148.webp\" alt=\"thinkphp 3.1.2\u662f\u5426\u652f\u6301PHP7.0\" \/><\/p>\n<p><p><strong>ThinkPHP 3.1.2 \u4e0d\u5b8c\u5168\u652f\u6301PHP7.0<\/strong>\uff0c\u8fd9\u4e3b\u8981\u662f\u7531\u4e8e<strong>ThinkPHP 3.1.2\u7684\u8bbe\u8ba1\u521d\u8877\u662f\u57fa\u4e8ePHP5\u7cfb\u5217<\/strong>\uff0c\u800cPHP7.0\u5f15\u5165\u4e86\u8bb8\u591a\u65b0\u7279\u6027\u548c\u6539\u8fdb\uff0c\u5305\u62ec\u7c7b\u578b\u58f0\u660e\u7684\u53d8\u5316\u3001\u65b0\u7684\u9519\u8bef\u5904\u7406\u65b9\u5f0f\u3001\u5e9f\u5f03\u7684\u65e7\u7279\u6027\u7b49\u3002\u5bfc\u81f4ThinkPHP 3.1.2\u5728\u517c\u5bb9\u6027\u65b9\u9762\u5b58\u5728\u4e00\u4e9b\u95ee\u9898\uff0c\u5c24\u5176\u662f\u5728\u9519\u8bef\u5904\u7406\u548c\u5e9f\u5f03\u7684\u51fd\u6570\u4f7f\u7528\u4e0a\u3002<\/p>\n<\/p>\n<p><p>PHP7.0\u5e26\u6765\u4e86\u663e\u8457\u7684\u6027\u80fd\u63d0\u5347\u548c\u65b0\u7279\u6027\uff0c\u4f46\u8fd9\u4e5f\u5bf9\u65e7\u7248\u672c\u7684\u6846\u67b6\u63d0\u51fa\u4e86\u6311\u6218\u3002<strong>\u4f8b\u5982\uff0cPHP7\u5bf9\u5f02\u5e38\u5904\u7406\u8fdb\u884c\u4e86\u91cd\u5927\u6539\u53d8<\/strong>\uff0c\u5f15\u5165\u4e86Throwable\u63a5\u53e3\uff0c\u4f7f\u5f97\u5f02\u5e38\u5904\u7406\u65b9\u5f0f\u66f4\u52a0\u7edf\u4e00\u3002ThinkPHP 3.1.2\u7684\u5f02\u5e38\u5904\u7406\u673a\u5236\u6ca1\u6709\u9488\u5bf9\u8fd9\u4e00\u6539\u53d8\u8fdb\u884c\u66f4\u65b0\uff0c\u5bfc\u81f4\u5728\u4f7f\u7528PHP7\u65f6\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u517c\u5bb9\u6027\u95ee\u9898\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001PHP7.0\u7684\u65b0\u7279\u6027\u5bf9\u65e7\u7248ThinkPHP\u7684\u5f71\u54cd<\/h3>\n<\/p>\n<p><h4>\u5f02\u5e38\u5904\u7406\u7684\u53d8\u5316<\/h4>\n<\/p>\n<p><p>PHP7\u5f15\u5165\u4e86\u4e24\u4e2a\u65b0\u7684\u57fa\u7840\u63a5\u53e3\uff1aThrowable\u548cError\uff0c\u8fd9\u4e24\u8005\u90fd\u53ef\u4ee5\u88abtry-catch\u7ed3\u6784\u6355\u83b7\u3002\u7136\u800c\uff0cThinkPHP 3.1.2\u7684\u5f02\u5e38\u5904\u7406\u662f\u57fa\u4e8e\u65e7\u7248\u7684Exception\u7c7b\u3002\u8fd9\u610f\u5473\u7740\u5728PHP7\u73af\u5883\u4e0b\u8fd0\u884c\u65f6\uff0c\u672a\u88abThrowable\u6355\u83b7\u7684\u9519\u8bef\u4f1a\u5bfc\u81f4\u4e0d\u53ef\u9884\u89c1\u7684\u884c\u4e3a\u3002<\/p>\n<\/p>\n<p><h4>\u5e9f\u5f03\u7684\u7279\u6027\u548c\u51fd\u6570<\/h4>\n<\/p>\n<p><p>PHP7\u5220\u9664\u548c\u5e9f\u5f03\u4e86\u4e00\u4e9b\u65e7\u6709\u7684\u7279\u6027\u548c\u51fd\u6570\uff0c\u5982\u679cThinkPHP 3.1.2\u7684\u4ee3\u7801\u4e2d\u4f7f\u7528\u4e86\u8fd9\u4e9b\u7279\u6027\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u8b66\u544a\u6216\u81f4\u547d\u9519\u8bef\u3002\u6bd4\u5982\uff0cPHP7\u79fb\u9664\u4e86\u539f\u751f\u7684mysql\u6269\u5c55\uff0c\u800cThinkPHP 3.1.2\u53ef\u80fd\u5728\u67d0\u4e9b\u6570\u636e\u5e93\u64cd\u4f5c\u4e2d\u8fd8\u5728\u4f7f\u7528\u8be5\u6269\u5c55\uff0c\u8fd9\u5728PHP7\u73af\u5883\u4e0b\u5c06\u4e0d\u518d\u53ef\u884c\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u5347\u7ea7ThinkPHP\u7248\u672c\u4ee5\u63d0\u5347\u517c\u5bb9\u6027<\/h3>\n<\/p>\n<p><h4>\u9009\u62e9\u66f4\u9ad8\u7248\u672c\u7684ThinkPHP\u6846\u67b6<\/h4>\n<\/p>\n<p><p>\u4e3a\u4e86\u5145\u5206\u5229\u7528PHP7\u7684\u65b0\u7279\u6027\u4e14\u907f\u514d\u517c\u5bb9\u6027\u95ee\u9898\uff0c\u63a8\u8350\u5347\u7ea7\u5230\u66f4\u9ad8\u7248\u672c\u7684ThinkPHP\uff08\u5982ThinkPHP5\u62166\uff09\uff0c\u8fd9\u4e9b\u7248\u672c\u9488\u5bf9PHP7\u505a\u4e86\u4f18\u5316\u548c\u8c03\u6574\uff0c\u63d0\u4f9b\u4e86\u66f4\u597d\u7684\u6027\u80fd\u548c\u517c\u5bb9\u6027\u3002<\/p>\n<\/p>\n<p><h4>\u8f6c\u79fb\u8fc7\u7a0b\u4e2d\u7684\u6ce8\u610f\u4e8b\u9879<\/h4>\n<\/p>\n<p><p>\u5728\u4eceThinkPHP 3.1.2\u5347\u7ea7\u5230\u66f4\u9ad8\u7248\u672c\u7684\u8fc7\u7a0b\u4e2d\uff0c\u9700\u8981\u4ed4\u7ec6\u68c0\u67e5\u4ee3\u7801\u7684\u517c\u5bb9\u6027\uff0c\u9010\u4e00\u5904\u7406\u53ef\u80fd\u51fa\u73b0\u7684\u95ee\u9898\u3002\u540c\u65f6\uff0c\u5229\u7528ThinkPHP\u5b98\u65b9\u63d0\u4f9b\u7684\u8fc1\u79fb\u6307\u5357\u53ef\u4ee5\u5927\u5927\u7b80\u5316\u5347\u7ea7\u8fc7\u7a0b\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001ThinkPHP 3.1.2\u5728PHP7\u73af\u5883\u4e0b\u7684\u5e94\u7528\u7b56\u7565<\/h3>\n<\/p>\n<p><h4>\u9519\u8bef\u548c\u5f02\u5e38\u5904\u7406\u7684\u8c03\u6574<\/h4>\n<\/p>\n<p><p>\u4e3a\u4fdd\u969c\u5728PHP7\u73af\u5883\u4e0b\u7684\u8fd0\u884c\uff0c\u53ef\u4ee5\u901a\u8fc7\u81ea\u5b9a\u4e49\u9519\u8bef\u548c\u5f02\u5e38\u5904\u7406\u5668\u6765\u6865\u63a5ThinkPHP 3.1.2\u4e0ePHP7\u7684\u5dee\u5f02\uff0c\u5c24\u5176\u662f\u5229\u7528set_error_handler\u548cset_exception_handler\u51fd\u6570\u6765\u517c\u5bb9\u65b0\u7684\u5f02\u5e38\u5904\u7406\u673a\u5236\u3002<\/p>\n<\/p>\n<p><h4>\u4ee3\u7801\u68c0\u67e5\u548c\u4fee\u6b63<\/h4>\n<\/p>\n<p><p>\u5229\u7528PHP7\u63d0\u4f9b\u7684\u9519\u8bef\u6291\u5236\u7b26\u548c\u7c7b\u578b\u58f0\u660e\uff0c\u91cd\u65b0\u68c0\u67e5\u548c\u4fee\u6b63ThinkPHP 3.1.2\u7684\u4ee3\u7801\uff0c\u5c24\u5176\u662f\u90a3\u4e9b\u5728PHP7\u73af\u5883\u4e0b\u5df2\u88ab\u5e9f\u5f03\u7684\u51fd\u6570\u548c\u7279\u6027\uff0c\u786e\u4fdd\u4ee3\u7801\u7684\u5065\u58ee\u6027\u548c\u6700\u65b0\u6027\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u7ed3\u8bba\u4e0e\u5efa\u8bae<\/h3>\n<\/p>\n<p><p>\u5c3d\u7ba1ThinkPHP 3.1.2\u5728\u8bbe\u8ba1\u65f6\u5e76\u672a\u8003\u8651\u4e0ePHP7\u7684\u5b8c\u5168\u517c\u5bb9\u6027\uff0c\u901a\u8fc7\u4e00\u7cfb\u5217\u7684\u8c03\u6574\u548c\u4f18\u5316\uff0c\u4ecd\u7136\u6709\u53ef\u80fd\u5728PHP7.0\u73af\u5883\u4e0b\u8fd0\u884c\u3002\u4f46\u4e3a\u4e86\u5145\u5206\u53d1\u6325PHP7\u7684\u6027\u80fd\u4f18\u52bf\u548c\u907f\u514d\u6f5c\u5728\u7684\u517c\u5bb9\u6027\u95ee\u9898\uff0c\u5f3a\u70c8\u5efa\u8bae\u5347\u7ea7\u5230\u66f4\u9ad8\u7248\u672c\u7684ThinkPHP\u6846\u67b6\u3002\u8fd9\u4e0d\u4ec5\u53ef\u4ee5\u63d0\u5347\u5e94\u7528\u7684\u6027\u80fd\uff0c\u66f4\u53ef\u4ee5\u786e\u4fdd\u5728\u672a\u6765\u7684PHP\u7248\u672c\u4e2d\u7ef4\u6301\u826f\u597d\u7684\u517c\u5bb9\u6027\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>\u95ee\u98981\uff1a<\/strong> thinkphp 3.1.2\u662f\u5426\u517c\u5bb9PHP7.0\u7248\u672c\uff1f<\/p>\n<p>\u7b54\uff1a\u662f\u7684\uff0cthinkphp 3.1.2\u662f\u517c\u5bb9PHP7.0\u7248\u672c\u7684\u3002\u867d\u7136\u8be5\u7248\u672c\u53d1\u5e03\u65f6\u4e3b\u8981\u9488\u5bf9PHP5.x\u7248\u672c\u8fdb\u884c\u4e86\u4f18\u5316\uff0c\u4f46\u662f\u7ecf\u8fc7\u6d4b\u8bd5\uff0c\u5b83\u4e5f\u80fd\u591f\u5728PHP7.0\u4e0a\u6b63\u5e38\u8fd0\u884c\u3002\u7136\u800c\uff0c\u5efa\u8bae\u5c3d\u5feb\u5347\u7ea7\u5230\u8f83\u65b0\u7684thinkphp\u7248\u672c\uff0c\u56e0\u4e3athinkphp\u5bf9\u4e8ePHP7.x\u7cfb\u5217\u7248\u672c\u8fdb\u884c\u4e86\u66f4\u597d\u7684\u4f18\u5316\u548c\u652f\u6301\u3002<\/p>\n<p><strong>\u95ee\u98982\uff1a<\/strong> thinkphp 3.1.2\u80fd\u5426\u4e0ePHP7.0\u4e00\u8d77\u4f7f\u7528\uff1f<\/p>\n<p>\u7b54\uff1a\u662f\u7684\uff0cthinkphp 3.1.2\u53ef\u4ee5\u4e0ePHP7.0\u4e00\u8d77\u4f7f\u7528\u3002\u4e0d\u8fc7\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u7531\u4e8ePHP7.0\u5f15\u5165\u4e86\u4e00\u4e9b\u65b0\u7684\u8bed\u6cd5\u548c\u7279\u6027\uff0c\u56e0\u6b64\u5728\u4f7f\u7528thinkphp 3.1.2\u65f6\u9700\u8981\u786e\u4fdd\u4ee3\u7801\u4e2d\u6ca1\u6709\u4f7f\u7528\u5230PHP7.0\u4e0d\u652f\u6301\u7684\u8bed\u6cd5\u6216\u529f\u80fd\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u5982\u679c\u4ee3\u7801\u5728PHP5.x\u4e0a\u8fd0\u884c\u6b63\u5e38\uff0c\u90a3\u4e48\u5927\u90e8\u5206\u60c5\u51b5\u4e0b\u5728PHP7.0\u4e0a\u4e5f\u80fd\u6b63\u5e38\u8fd0\u884c\u3002<\/p>\n<p><strong>\u95ee\u98983\uff1a<\/strong> \u5982\u4f55\u5c06\u6211\u73b0\u6709\u7684thinkphp 3.1.2\u9879\u76ee\u8fc1\u79fb\u5230PHP7.0\uff1f<\/p>\n<p>\u7b54\uff1a\u5c06thinkphp 3.1.2\u9879\u76ee\u8fc1\u79fb\u5230PHP7.0\u76f8\u5bf9\u7b80\u5355\u3002\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u7684\u9879\u76ee\u4ee3\u7801\u548c\u4f9d\u8d56\u90fd\u6ca1\u6709\u4f7f\u7528\u5230PHP7.0\u4e0d\u652f\u6301\u7684\u8bed\u6cd5\u6216\u529f\u80fd\u3002\u63a5\u4e0b\u6765\uff0c\u5c06PHP\u7248\u672c\u5207\u6362\u52307.0\uff0c\u6bd4\u5982\u901a\u8fc7\u4fee\u6539\u670d\u52a1\u5668\u914d\u7f6e\u6587\u4ef6\u6216\u8005\u4f7f\u7528\u547d\u4ee4\u884c\u7b49\u65b9\u5f0f\u3002\u7136\u540e\uff0c\u518d\u6b21\u6d4b\u8bd5\u4f60\u7684\u9879\u76ee\uff0c\u5982\u679c\u51fa\u73b0\u4e86\u95ee\u9898\uff0c\u6839\u636e\u62a5\u9519\u4fe1\u606f\u8fdb\u884c\u76f8\u5e94\u7684\u4fee\u590d\u3002\u6700\u540e\uff0c\u786e\u4fdd\u4f60\u7684\u9879\u76ee\u5728PHP7.0\u4e0a\u80fd\u591f\u6b63\u5e38\u8fd0\u884c\u540e\uff0c\u5373\u53ef\u5b8c\u6210\u8fc1\u79fb\u5de5\u4f5c\u3002\u4e0d\u8fc7\uff0c\u9274\u4e8ethinkphp 3.1.2\u5e76\u4e0d\u662f\u4e13\u95e8\u4e3aPHP7.0\u4f18\u5316\u7684\u7248\u672c\uff0c\u5efa\u8bae\u5c3d\u5feb\u5347\u7ea7\u5230\u8f83\u65b0\u7684thinkphp\u7248\u672c\uff0c\u4ee5\u83b7\u5f97\u66f4\u597d\u7684\u6027\u80fd\u548c\u7a33\u5b9a\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"ThinkPHP 3.1.2 \u4e0d\u5b8c\u5168\u652f\u6301PHP7.0\uff0c\u8fd9\u4e3b\u8981\u662f\u7531\u4e8eThinkPHP 3.1.2\u7684\u8bbe\u8ba1\u521d\u8877\u662f\u57fa\u4e8e [&hellip;]","protected":false},"author":3,"featured_media":184002,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/183990"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=183990"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/183990\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/184002"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=183990"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=183990"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=183990"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}