{"id":22355,"date":"2024-11-21T11:30:17","date_gmt":"2024-11-21T03:30:17","guid":{"rendered":"https:\/\/fwq.ai\/blog\/22355\/"},"modified":"2024-11-21T11:30:17","modified_gmt":"2024-11-21T03:30:17","slug":"laravel%e5%a6%82%e4%bd%95%e5%ae%89%e8%a3%85%ef%bc%9f%e5%ae%89%e8%a3%85%e6%9d%a1%e4%bb%b6%e6%b5%85%e6%9e%90","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/22355\/","title":{"rendered":"laravel\u5982\u4f55\u5b89\u88c5\uff1f\u5b89\u88c5\u6761\u4ef6\u6d45\u6790"},"content":{"rendered":"<p>laravel\u662f\u4e00\u79cd\u65b0\u5174\u7684web\u5e94\u7528\u7a0b\u5e8f\u6846\u67b6\u3002\u5b83\u4f7f\u7528php\u8bed\u8a00\u548cmvc\uff08\u6a21\u578b\u89c6\u56fe\u63a7\u5236\u5668\uff09\u67b6\u6784\uff0c\u4f7f\u5f00\u53d1\u5927\u578b\u7f51\u7edc\u5e94\u7528\u7a0b\u5e8f\u53d8\u5f97\u66f4\u52a0\u7b80\u5355\u548c\u8f7b\u677e\u3002\u4e0e\u5176\u4ed6\u6846\u67b6\u76f8\u6bd4\uff0claravel\u6781\u4e3a\u7075\u6d3b\uff0c\u6613\u4e8e\u4f7f\u7528\uff0c\u56e0\u6b64\u5927\u53d7\u6b22\u8fce\u3002<\/p>\n<p>\u5728\u4f7f\u7528Laravel\u4e4b\u524d\uff0c\u9996\u5148\u8981\u4e86\u89e3\u5b83\u7684\u5b89\u88c5\u8981\u6c42\u3002\u4ee5\u4e0b\u662fLaravel\u7684\u5b89\u88c5\u6761\u4ef6\u3002<\/p>\n<ol>\n<li>PHP\u7248\u672c<\/li>\n<\/ol>\n<p>\u5b89\u88c5Laravel\u4e4b\u524d\uff0c\u60a8\u9700\u8981\u786e\u4fdd\u60a8\u7684PHP\u7248\u672c\u7b26\u5408\u8981\u6c42\u3002Laravel\u6700\u4f4e\u652f\u6301\u7684PHP\u7248\u672c\u662f5.5.9\uff0c\u4f46\u662f\u5efa\u8bae\u4f7f\u7528PHP 7.3\u53ca\u66f4\u9ad8\u7248\u672c\uff0c\u56e0\u4e3a\u8fd9\u4e9b\u7248\u672c\u63d0\u4f9b\u4e86\u66f4\u9ad8\u7684\u6027\u80fd\u548c\u66f4\u597d\u7684\u5b89\u5168\u6027\u3002<\/p>\n<p>\u60a8\u53ef\u4ee5\u901a\u8fc7\u6253\u5f00\u7ec8\u7aef\uff08\u5728Windows\u4e0a\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u63d0\u793a\u7b26\uff09\u5e76\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u68c0\u67e5\u60a8\u7684PHP\u7248\u672c\uff1a<\/p>\n<pre>php -v<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>Web\u670d\u52a1\u5668<\/li>\n<\/ol>\n<p>Laravel\u9700\u8981\u4e00\u4e2aWeb\u670d\u52a1\u5668\u6765\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\u3002\u60a8\u53ef\u4ee5\u5728Apache\uff0cNginx\u548cIIS\u7b49Web\u670d\u52a1\u5668\u4e0a\u5b89\u88c5Laravel\u3002\u6709\u8bb8\u591a\u670d\u52a1\u5668\u8f6f\u4ef6\u53ef\u4ee5\u4f7f\u7528\uff0c\u4f46\u662f\u9700\u8981\u786e\u4fdd\u5b83\u53ef\u4ee5\u89e3\u91caPHP\u6587\u4ef6\u3002<\/p>\n<ol>\n<li>\u6570\u636e\u5e93<\/li>\n<\/ol>\n<p>Laravel\u9700\u8981\u4e00\u4e2a\u6570\u636e\u5e93\u6765\u5b58\u50a8\u5e94\u7528\u7a0b\u5e8f\u6570\u636e\u3002Laravel\u652f\u6301\u591a\u79cd\u7c7b\u578b\u7684\u6570\u636e\u5e93\uff0c\u5305\u62ecMySQL\uff0cPostgreSQL\uff0cSQLite\u548cSQL Server\u3002\u5728\u5b89\u88c5Laravel\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd\u60a8\u5df2\u5b89\u88c5\u9002\u5f53\u7684\u670d\u52a1\u5668\u8f6f\u4ef6\u5e76\u521b\u5efa\u4e86\u4e00\u4e2a\u6570\u636e\u5e93\u3002<\/p>\n<ol>\n<li>Composer<\/li>\n<\/ol>\n<p>Composer\u662fPHP\u7684\u4f9d\u8d56\u7ba1\u7406\u5668\u3002Laravel\u4f7f\u7528Composer\u6765\u5b89\u88c5\u548c\u7ba1\u7406PHP\u5e93\u548c\u4f9d\u8d56\u9879\u3002\u5728\u5b89\u88c5Laravel\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd\u60a8\u5df2\u5b89\u88c5Composer\u5e76\u5c06\u5176\u6dfb\u52a0\u5230\u60a8\u7684\u7cfb\u7edf\u8def\u5f84\u4e2d\u3002<\/p>\n<p>\u8981\u5b89\u88c5Composer\uff0c\u8bf7\u6253\u5f00\u7ec8\u7aef\u5e76\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>curl -sS https:\/\/getcomposer.org\/installer | php\nsudo mv composer.phar \/usr\/local\/bin\/composer<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u5176\u4ed6\u6269\u5c55<\/li>\n<\/ol>\n<p>Laravel\u8fd8\u9700\u8981\u5176\u4ed6\u6269\u5c55\u6765\u4f7f\u5176\u5de5\u4f5c\u3002\u8fd9\u4e9b\u6269\u5c55\u5305\u62ecmbstring\uff0ctokenizer\uff0cJSON\u548cXML\u7b49\u3002\u5728\u5b89\u88c5Laravel\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd\u5df2\u5b89\u88c5\u8fd9\u4e9b\u6269\u5c55\u3002<\/p>\n<p>\u5728Linux\u7cfb\u7edf\u4e0a\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\u8fd9\u4e9b\u6269\u5c55\uff1a<\/p>\n<pre>sudo apt-get install php-mbstring php-tokenizer php-json php-xml<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5728Windows\u7cfb\u7edf\u4e0a\uff0c\u60a8\u9700\u8981\u7f16\u8f91php.ini\u6587\u4ef6\u5e76\u53d6\u6d88\u6ce8\u91ca\u4ee5\u4e0b\u884c\uff1a<\/p>\n<pre>extension=php_mbstring.dll\nextension=php_tokenizer.dll\nextension=php_xml.dll\nextension=php_json.dll<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u4ee5\u4e0a\u662fLaravel\u7684\u5b89\u88c5\u6761\u4ef6\u3002\u5982\u679c\u60a8\u6ee1\u8db3\u4ee5\u4e0a\u8981\u6c42\uff0c\u5c31\u53ef\u4ee5\u5b89\u88c5Laravel\u5e76\u5f00\u59cb\u6784\u5efa\u51fa\u8272\u7684Web\u5e94\u7528\u7a0b\u5e8f\u4e86\uff01<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662flaravel\u5982\u4f55\u5b89\u88c5\uff1f\u5b89\u88c5\u6761\u4ef6\u6d45\u6790\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>laravel\u662f\u4e00\u79cd\u65b0\u5174\u7684web\u5e94\u7528\u7a0b\u5e8f\u6846\u67b6\u3002\u5b83\u4f7f\u7528php\u8bed\u8a00\u548cmvc\uff08\u6a21\u578b\u89c6\u56fe\u63a7\u5236\u5668\uff09\u67b6\u6784\uff0c\u4f7f\u5f00\u53d1\u5927\u578b\u7f51\u7edc\u5e94\u7528\u7a0b\u5e8f\u53d8\u5f97\u66f4\u52a0\u7b80\u5355\u548c\u8f7b\u677e\u3002\u4e0e\u5176\u4ed6\u6846\u67b6\u76f8\u6bd4\uff0claravel\u6781\u4e3a\u7075\u6d3b\uff0c\u6613\u4e8e\u4f7f\u7528\uff0c\u56e0\u6b64\u5927\u53d7\u6b22\u8fce\u3002 \u5728\u4f7f\u7528Laravel\u4e4b\u524d\uff0c\u9996\u5148\u8981\u4e86\u89e3\u5b83\u7684\u5b89\u88c5\u8981\u6c42\u3002\u4ee5\u4e0b\u662fLaravel\u7684\u5b89\u88c5\u6761\u4ef6\u3002 PHP\u7248\u672c \u5b89\u88c5Laravel\u4e4b\u524d\uff0c\u60a8\u9700\u8981\u786e\u4fdd\u60a8\u7684PHP\u7248\u672c\u7b26\u5408\u8981\u6c42\u3002Laravel\u6700\u4f4e\u652f\u6301\u7684PHP\u7248\u672c\u662f5.5.9\uff0c\u4f46\u662f\u5efa\u8bae\u4f7f\u7528PHP 7.3\u53ca\u66f4\u9ad8\u7248\u672c\uff0c\u56e0\u4e3a\u8fd9\u4e9b\u7248\u672c\u63d0\u4f9b\u4e86\u66f4\u9ad8\u7684\u6027\u80fd\u548c\u66f4\u597d\u7684\u5b89\u5168\u6027\u3002 \u60a8\u53ef\u4ee5\u901a\u8fc7\u6253\u5f00\u7ec8\u7aef\uff08\u5728Windows\u4e0a\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u63d0\u793a\u7b26\uff09\u5e76\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u68c0\u67e5\u60a8\u7684PHP\u7248\u672c\uff1a php -v \u767b\u5f55\u540e\u590d\u5236 Web\u670d\u52a1\u5668 Laravel\u9700\u8981\u4e00\u4e2aWeb\u670d\u52a1\u5668\u6765\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\u3002\u60a8\u53ef\u4ee5\u5728Apache\uff0cNginx\u548cIIS\u7b49Web\u670d\u52a1\u5668\u4e0a\u5b89\u88c5Laravel\u3002\u6709\u8bb8\u591a\u670d\u52a1\u5668\u8f6f\u4ef6\u53ef\u4ee5\u4f7f\u7528\uff0c\u4f46\u662f\u9700\u8981\u786e\u4fdd\u5b83\u53ef\u4ee5\u89e3\u91caPHP\u6587\u4ef6\u3002 \u6570\u636e\u5e93 Laravel\u9700\u8981\u4e00\u4e2a\u6570\u636e\u5e93\u6765\u5b58\u50a8\u5e94\u7528\u7a0b\u5e8f\u6570\u636e\u3002Laravel\u652f\u6301\u591a\u79cd\u7c7b\u578b\u7684\u6570\u636e\u5e93\uff0c\u5305\u62ecMySQL\uff0cPostgreSQL\uff0cSQLite\u548cSQL Server\u3002\u5728\u5b89\u88c5Laravel\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd\u60a8\u5df2\u5b89\u88c5\u9002\u5f53\u7684\u670d\u52a1\u5668\u8f6f\u4ef6\u5e76\u521b\u5efa\u4e86\u4e00\u4e2a\u6570\u636e\u5e93\u3002 Composer Composer\u662fPHP\u7684\u4f9d\u8d56\u7ba1\u7406\u5668\u3002Laravel\u4f7f\u7528Composer\u6765\u5b89\u88c5\u548c\u7ba1\u7406PHP\u5e93\u548c\u4f9d\u8d56\u9879\u3002\u5728\u5b89\u88c5Laravel\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd\u60a8\u5df2\u5b89\u88c5Composer\u5e76\u5c06\u5176\u6dfb\u52a0\u5230\u60a8\u7684\u7cfb\u7edf\u8def\u5f84\u4e2d\u3002 \u8981\u5b89\u88c5Composer\uff0c\u8bf7\u6253\u5f00\u7ec8\u7aef\u5e76\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a curl -sS https:\/\/getcomposer.org\/installer | php sudo mv composer.phar \/usr\/local\/bin\/composer \u767b\u5f55\u540e\u590d\u5236 \u5176\u4ed6\u6269\u5c55 Laravel\u8fd8\u9700\u8981\u5176\u4ed6\u6269\u5c55\u6765\u4f7f\u5176\u5de5\u4f5c\u3002\u8fd9\u4e9b\u6269\u5c55\u5305\u62ecmbstring\uff0ctokenizer\uff0cJSON\u548cXML\u7b49\u3002\u5728\u5b89\u88c5Laravel\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd\u5df2\u5b89\u88c5\u8fd9\u4e9b\u6269\u5c55\u3002 \u5728Linux\u7cfb\u7edf\u4e0a\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\u8fd9\u4e9b\u6269\u5c55\uff1a sudo apt-get install php-mbstring php-tokenizer php-json php-xml \u767b\u5f55\u540e\u590d\u5236 \u5728Windows\u7cfb\u7edf\u4e0a\uff0c\u60a8\u9700\u8981\u7f16\u8f91php.ini\u6587\u4ef6\u5e76\u53d6\u6d88\u6ce8\u91ca\u4ee5\u4e0b\u884c\uff1a extension=php_mbstring.dll extension=php_tokenizer.dll extension=php_xml.dll extension=php_json.dll \u767b\u5f55\u540e\u590d\u5236 \u4ee5\u4e0a\u662fLaravel\u7684\u5b89\u88c5\u6761\u4ef6\u3002\u5982\u679c\u60a8\u6ee1\u8db3\u4ee5\u4e0a\u8981\u6c42\uff0c\u5c31\u53ef\u4ee5\u5b89\u88c5Laravel\u5e76\u5f00\u59cb\u6784\u5efa\u51fa\u8272\u7684Web\u5e94\u7528\u7a0b\u5e8f\u4e86\uff01 \u4ee5\u4e0a\u5c31\u662flaravel\u5982\u4f55\u5b89\u88c5\uff1f\u5b89\u88c5\u6761\u4ef6\u6d45\u6790\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-22355","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/22355","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=22355"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/22355\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=22355"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=22355"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=22355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}