{"id":12150,"date":"2020-05-15T00:00:00","date_gmt":"2020-05-14T16:00:00","guid":{"rendered":"https:\/\/fgchen.com\/wpedu2\/2020\/05\/15\/%e3%80%90%e7%ad%86%e8%a8%98-laravel%e3%80%91laravel%e7%9a%84%e7%9b%ae%e9%8c%84%e7%b5%90%e6%a7%8b\/"},"modified":"2026-03-30T14:40:56","modified_gmt":"2026-03-30T06:40:56","slug":"%e3%80%90%e7%ad%86%e8%a8%98-laravel%e3%80%91laravel%e7%9a%84%e7%9b%ae%e9%8c%84%e7%b5%90%e6%a7%8b","status":"publish","type":"post","link":"https:\/\/fgchen.com\/wpedu\/2020\/05\/%e3%80%90%e7%ad%86%e8%a8%98-laravel%e3%80%91laravel%e7%9a%84%e7%9b%ae%e9%8c%84%e7%b5%90%e6%a7%8b\/","title":{"rendered":"\u3010\u7b46\u8a18-Laravel\u3011Laravel\u7684\u76ee\u9304\u7d50\u69cb"},"content":{"rendered":"\u5e95\u4e0b\u8868\u683c\u662f\u5f9eLaravel\u5b98\u65b9\u6587\u4ef6\u8907\u88fd\u904e\u4f86\u76845\u30016\u30017\u7248\u7684\u76ee\u9304\u7d50\u69cb\uff0c\u5b8c\u5168\u4e00\u6a23\uff0c\u6c92\u6709\u8b8a\u52d5\u3002\n\n<table style=\"border-collapse: collapse;width: 100%\">\n<tbody>\n<tr>\n<td style=\"width: 33.3333%\">5.8<\/td>\n<td style=\"width: 33.3333%\">6.x<\/td>\n<td style=\"width: 33.3333%\">7.x<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 33.3333%\">\n<ul>\n    <li><a href=\"https:\/\/laravel.com\/docs\/5.8\/structure#the-root-directory\">The Root Directory<\/a>\n<ul>\n    <li><a href=\"https:\/\/laravel.com\/docs\/5.8\/structure#the-root-app-directory\">The\u00a0<code>app<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/5.8\/structure#the-bootstrap-directory\">The\u00a0<code>bootstrap<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/5.8\/structure#the-config-directory\">The\u00a0<code>config<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/5.8\/structure#the-database-directory\">The\u00a0<code>database<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/5.8\/structure#the-public-directory\">The\u00a0<code><span class=\"token keyword\">public<\/span><\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/5.8\/structure#the-resources-directory\">The\u00a0<code>resources<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/5.8\/structure#the-routes-directory\">The\u00a0<code>routes<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/5.8\/structure#the-storage-directory\">The\u00a0<code>storage<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/5.8\/structure#the-tests-directory\">The\u00a0<code>tests<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/5.8\/structure#the-vendor-directory\">The\u00a0<code>vendor<\/code>\u00a0Directory<\/a><\/li>\n<\/ul>\n<\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/5.8\/structure#the-app-directory\">The App Directory<\/a>\n<ul>\n    <li><a href=\"https:\/\/laravel.com\/docs\/5.8\/structure#the-broadcasting-directory\">The\u00a0<code>Broadcasting<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/5.8\/structure#the-console-directory\">The\u00a0<code>Console<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/5.8\/structure#the-events-directory\">The\u00a0<code>Events<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/5.8\/structure#the-exceptions-directory\">The\u00a0<code>Exceptions<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/5.8\/structure#the-http-directory\">The\u00a0<code>Http<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/5.8\/structure#the-jobs-directory\">The\u00a0<code>Jobs<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/5.8\/structure#the-listeners-directory\">The\u00a0<code>Listeners<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/5.8\/structure#the-mail-directory\">The\u00a0<code>Mail<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/5.8\/structure#the-notifications-directory\">The\u00a0<code>Notifications<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/5.8\/structure#the-policies-directory\">The\u00a0<code>Policies<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/5.8\/structure#the-providers-directory\">The\u00a0<code>Providers<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/5.8\/structure#the-rules-directory\">The\u00a0<code>Rules<\/code>\u00a0Directory<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/td>\n<td style=\"width: 33.3333%\">\n<ul>\n    <li><a href=\"https:\/\/laravel.com\/docs\/6.x\/structure#the-root-directory\">The Root Directory<\/a>\n<ul>\n    <li><a href=\"https:\/\/laravel.com\/docs\/6.x\/structure#the-root-app-directory\">The\u00a0<code>app<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/6.x\/structure#the-bootstrap-directory\">The\u00a0<code>bootstrap<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/6.x\/structure#the-config-directory\">The\u00a0<code>config<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/6.x\/structure#the-database-directory\">The\u00a0<code>database<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/6.x\/structure#the-public-directory\">The\u00a0<code><span class=\"token keyword\">public<\/span><\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/6.x\/structure#the-resources-directory\">The\u00a0<code>resources<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/6.x\/structure#the-routes-directory\">The\u00a0<code>routes<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/6.x\/structure#the-storage-directory\">The\u00a0<code>storage<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/6.x\/structure#the-tests-directory\">The\u00a0<code>tests<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/6.x\/structure#the-vendor-directory\">The\u00a0<code>vendor<\/code>\u00a0Directory<\/a><\/li>\n<\/ul>\n<\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/6.x\/structure#the-app-directory\">The App Directory<\/a>\n<ul>\n    <li><a href=\"https:\/\/laravel.com\/docs\/6.x\/structure#the-broadcasting-directory\">The\u00a0<code>Broadcasting<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/6.x\/structure#the-console-directory\">The\u00a0<code>Console<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/6.x\/structure#the-events-directory\">The\u00a0<code>Events<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/6.x\/structure#the-exceptions-directory\">The\u00a0<code>Exceptions<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/6.x\/structure#the-http-directory\">The\u00a0<code>Http<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/6.x\/structure#the-jobs-directory\">The\u00a0<code>Jobs<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/6.x\/structure#the-listeners-directory\">The\u00a0<code>Listeners<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/6.x\/structure#the-mail-directory\">The\u00a0<code>Mail<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/6.x\/structure#the-notifications-directory\">The\u00a0<code>Notifications<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/6.x\/structure#the-policies-directory\">The\u00a0<code>Policies<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/6.x\/structure#the-providers-directory\">The\u00a0<code>Providers<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/6.x\/structure#the-rules-directory\">The\u00a0<code>Rules<\/code>\u00a0Directory<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/td>\n<td style=\"width: 33.3333%\">\n<ul>\n    <li><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-root-directory\">The Root Directory<\/a>\n<ul>\n    <li><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-root-app-directory\">The\u00a0<code>app<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-bootstrap-directory\">The\u00a0<code>bootstrap<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-config-directory\">The\u00a0<code>config<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-database-directory\">The\u00a0<code>database<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-public-directory\">The\u00a0<code><span class=\"token keyword\">public<\/span><\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-resources-directory\">The\u00a0<code>resources<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-routes-directory\">The\u00a0<code>routes<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-storage-directory\">The\u00a0<code>storage<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-tests-directory\">The\u00a0<code>tests<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-vendor-directory\">The\u00a0<code>vendor<\/code>\u00a0Directory<\/a><\/li>\n<\/ul>\n<\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-app-directory\">The App Directory<\/a>\n<ul>\n    <li><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-broadcasting-directory\">The\u00a0<code>Broadcasting<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-console-directory\">The\u00a0<code>Console<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-events-directory\">The\u00a0<code>Events<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-exceptions-directory\">The\u00a0<code>Exceptions<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-http-directory\">The\u00a0<code>Http<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-jobs-directory\">The\u00a0<code>Jobs<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-listeners-directory\">The\u00a0<code>Listeners<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-mail-directory\">The\u00a0<code>Mail<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-notifications-directory\">The\u00a0<code>Notifications<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-policies-directory\">The\u00a0<code>Policies<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-providers-directory\">The\u00a0<code>Providers<\/code>\u00a0Directory<\/a><\/li>\n    <li><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-rules-directory\">The\u00a0<code>Rules<\/code>\u00a0Directory<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\n&nbsp;\n\n<h2 id=\"the-root-directory\"><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-root-directory\">The Root Directory<\/a><\/h2>\n\n<h4 id=\"the-root-app-directory\"><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-root-app-directory\">The App Directory<\/a><\/h4>\n\n\u653e\u7f6e\u61c9\u7528\u7a0b\u5f0f\u7684\u6838\u5fc3\u7a0b\u5f0f\u78bc\uff0c\u6b64\u90e8\u4efd\u76ee\u9304\u5e95\u4e0b\u76ee\u9304\u7d30\u7bc0\u5728\u5f8c\u6558\u8ff0\u3002\n\n<h4 id=\"the-bootstrap-directory\"><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-bootstrap-directory\">The Bootstrap Directory<\/a><\/h4>\n\n\u6b64\u76ee\u9304\u5305\u542b\u7528\u4f86\u555f\u52d5\u6846\u67b6\u7684<code>app<span class=\"token punctuation\">.<\/span>php<\/code>\u6a94\u6848\uff0c\u6b64\u76ee\u9304\u4ea6\u653e\u7f6e\u4e86<code>cache<\/code> \u76ee\u9304\uff0c\u5305\u542b\u4e86\u6846\u67b6\u70ba\u4e86\u6548\u80fd\u6700\u4f73\u5316\u6240\u7522\u751f\u7684\u6a94\u6848\u3002\n\n<h4 id=\"the-config-directory\"><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-config-directory\">The Config Directory<\/a><\/h4>\n\n\u61c9\u7528\u7a0b\u5f0f\u8a2d\u7f6e\u76ee\u9304\u3002\n\n<h4 id=\"the-database-directory\"><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-database-directory\">The Database Directory<\/a><\/h4>\n\n\u5305\u542b\u8cc7\u6599\u5eab\u9077\u79fb\u3001\u6a21\u578b\u5de5\u5ee0\u3001\u4ee5\u53ca\u7a2e\u5b50\uff0c\u5982\u679c\u6709\u5fc5\u8981\u7684\u8a71\uff0c\u53ef\u4ee5\u5728\u9019\u500b\u76ee\u9304\u653e\u7f6eSQLite\u8cc7\u6599\u5eab\u3002\n\n<h4 id=\"the-public-directory\"><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-public-directory\">The Public Directory<\/a><\/h4>\n\n\u653e\u7f6e\u00a0<code>index<span class=\"token punctuation\">.<\/span>php<\/code> \u6a94, \u61c9\u7528\u7a0b\u5f0f\u7684\u9032\u5165\u9ede\uff0c\u5176\u4e2d\u5b9a\u7fa9\u4e86\u81ea\u52d5\u8f09\u5165\u6a5f\u5236(autoloading)\uff0c\u9019\u500b\u76ee\u9304\u4e5f\u653e\u7f6e\u4e86\u5982images, JavaScript, and CSS\u7b49\u6a94\u6848\u3002\n\n<h4 id=\"the-resources-directory\"><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-resources-directory\">The Resources Directory<\/a><\/h4>\n\n\u653e\u7f6e\u4e86\u6240\u6709\u7684 views \u6a94\u6848\uff0c\u4ee5\u53ca\u90a3\u4e9b\u672a\u7d93\u7de8\u7e79\u7684LESS, SASS, \u6216 JavaScript\uff0c\u9019\u500b\u76ee\u9304\u4e5f\u653e\u7f6e\u4e86\u8a9e\u7cfb\u6a94\u6848\u3002\n\n<h4 id=\"the-routes-directory\"><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-routes-directory\">The Routes Directory<\/a><\/h4>\n\n\u5305\u542b\u4e86\u6240\u6709\u61c9\u7528\u7a0b\u767c\u7684\u8def\u7531\u5b9a\u7fa9\uff0cLaravel\u9810\u8a2d\u5e95\u4e0b\u5e7e\u500b\u6a94\u6848\uff1a\u00a0<code>web<span class=\"token punctuation\">.<\/span>php<\/code>,\u00a0<code>api<span class=\"token punctuation\">.<\/span>php<\/code>,\u00a0<code>console<span class=\"token punctuation\">.<\/span>php<\/code>\u00a0and\u00a0<code>channels<span class=\"token punctuation\">.<\/span>php<\/code>.\n<code>web<span class=\"token punctuation\">.<\/span>php<\/code> \u6a94\u6848\u5305\u542b\u4e86\u5305\u542b\u4e86\u7531 <code>RouteServiceProvider<\/code>\u6240\u7522\u751f\u653e\u7f6e\u65bcweb\u4e2d\u4ecb\u8edf\u9ad4\u7fa4\u7d44\u7684\u8def\u7531\u6a94\u6848\uff0c\u9019\u4e9b\u8def\u7531\u63d0\u4f9b\u4e86\u6703\u8ac7\u72c0\u614b\u3001CSRF \u4fdd\u8b77\u6a5f\u5236\u3001\u4ee5\u53cacookie\u52a0\u5bc6\u3002 \u5982\u679c\u61c9\u7528\u7a0b\u5f0f\u672a\u5305\u542b\u4e00\u500b\u7121\u72c0\u614b\u7684 RESTful API\uff0c\u6240\u6709\u7684\u8def\u7531\u5c07\u6703\u5927\u81f4\u653e\u7f6e\u65bc <code>web<span class=\"token punctuation\">.<\/span>php<\/code>\u00a0\u6a94\u6848\u3002\n<code>api<span class=\"token punctuation\">.<\/span>php<\/code> \u6a94\u6848\u5305\u542b\u90a3\u4e9b\u7531<code>RouteServiceProvider<\/code> \u653e\u7f6e\u65bc <code>api<\/code> \u4e2d\u4ecb\u8edf\u9ad4\u7fa4\u7d44\u7684\u8def\u7531\u6a94\u6848\uff0c\u9019\u4e9b\u8def\u7531\u63d0\u4f9b\u4e86rate limiting\u3002\u9019\u4e9b\u8def\u7531\u57fa\u672c\u4e0a\u662f\u7121\u72c0\u614b\u7684\uff0c\u4f7f\u5f97\u900f\u904e\u9019\u4e9b\u8def\u7531\u9032\u5230\u61c9\u7528\u7a0b\u5f0f\u7684\u6240\u6709\u8acb\u6c42\u6703\u900f\u904etokens\u88abauthenticated(\u8eab\u4efd\u8a8d\u8b49)\uff0c\uff0c\u4e26\u4e14\u7121\u6cd5\u5b58\u53d6\u6703\u8ac7 session \u72c0\u614b\u3002\n<code>console<span class=\"token punctuation\">.<\/span>php<\/code> \u7528\u4f86\u5b9a\u7fa9\u6240\u6709\u9589\u5305\u4e2d\u63a7\u53f0\u6307\u4ee4\uff0c\u6bcf\u500b\u9589\u5305\u6307\u4ee4\u7e6b\u7d50\u4e00\u500b\u547d\u4ee4\u5be6\u4f8b\uff0c\u5145\u8a31\u4e00\u500b\u7c21\u55ae\u7684\u65b9\u6cd5\u8207\u6bcf\u4e00\u500b\u6307\u4ee4IO\u65b9\u6cd5\u4e92\u52d5\uff0c\u5373\u4f7f\u9019\u500b\u6a94\u6848\u6c92\u6709\u5b9a\u7fa9 HTTP \u8def\u7531\uff0c\u5b83\u5b9a\u7fa9\u4e86\u4e2d\u63a7\u53f0\u6a21\u5f0f\u7684\u61c9\u7528\u7a0b\u5f0f\u9032\u5165\u9ede(\u8def\u7531)\u3002\n<code>channels<span class=\"token punctuation\">.<\/span>php<\/code> \u8a3b\u518a\u61c9\u7528\u7a0b\u5f0f\u6240\u652f\u63f4\u7684\u4e8b\u4ef6\u5ee3\u64ad\u983b\u9053\u3002\n\n<h4 id=\"the-storage-directory\"><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-storage-directory\">The Storage Directory<\/a><\/h4>\n\n\u6b64\u76ee\u9304\u5305\u542b\u4e86\u6240\u6709\u7de8\u8b6f\u904e\u7684Blade\u6a23\u677f\u3001\u6a94\u6848\u578b\u5f0f\u7684\u72c0\u614b\u3001\u6a94\u6848\u5feb\u53d6\u3001\u53ca\u5176\u4ed6\u7531\u6846\u67b6(Laravel)\u6240\u7522\u751f\u7684\u6a94\u6848\u3002 \u9019\u500b\u76ee\u9304\u5206\u6210\u00a0<code>app<\/code>,\u00a0<code>framework<\/code>, p\u53ca\u00a0logs \u5e7e\u500b\u76ee\u9304\u3002app\u76ee\u9304\u53ef\u4ee5\u7528\u4f86\u5132\u5b58\u61c9\u7528\u7a0b\u5f0f\u6240\u7522\u751f\u7684\u4efb\u4f55\u6a94\u6848\uff0cframework\u76ee\u9304\u7528\u4f86\u5132\u5b58\u7531\u6846\u67b6\u6240\u7522\u751f\u7684\u6a94\u6848\u53ca\u5feb\u53d6\u8cc7\u6599\uff0c\u6700\u5f8c\uff0clogs\u76ee\u9304\u5305\u542b\u4e86\u61c9\u7528\u7a0b\u5f0f\u7684\u8a18\u9304\u6a94\u3002\n<code>storage<span class=\"token operator\">\/<\/span>app<span class=\"token operator\">\/<\/span><span class=\"token keyword\">public<\/span><\/code> \u76ee\u9304\u53ef\u4ee5\u7528\u4f86\u5132\u5b58\u4f7f\u7528\u8005\u7522\u751f\u7684\u6a94\u6848\uff0c\u50cf\u662favatars\u500b\u4eba\u8cc7\u6599\u6a94\u6848\uff0c\u9019\u4e9b\u672c\u4f86\u5c31\u61c9\u8a72\u958b\u653e\u5927\u773e\u5b58\u53d6\u7684\u3002\u4f60\u61c9\u8a72\u5728<code><span class=\"token keyword\">public<\/span><span class=\"token operator\">\/<\/span>storage<\/code>\u5efa\u7acb\u4e00\u500bsymbolic link\u6307\u5411\u9019\u500b\u76ee\u9304\uff0c\u53ef\u4ee5\u7528&#8221; <code>php artisan storage<span class=\"token punctuation\">:<\/span>link<\/code> &#8220;\u547d\u4ee4\u5efa\u7acb\u9019\u500b\u76ee\u9304\u7b26\u865f\u9023\u7d50 (\u865b\u64ec\u76ee\u9304\u7684\u610f\u601d)\u3002\n\n<h4 id=\"the-tests-directory\"><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-tests-directory\">The Tests Directory<\/a><\/h4>\n\n\u6b64\u76ee\u9304\u5305\u542b\u4e86\u81ea\u52d5\u6e2c\u8a66\u6848\u4f8b\uff0c<a href=\"https:\/\/phpunit.de\/\">PHPUnit<\/a> \u662f\u4e00\u500b\u7acb\u5373\u53ef\u7528\u7684\u6e2c\u8a66\u7bc4\u4f8b\uff0c\u6bcf\u500b\u6e2c\u8a66\u985e\u5225\u90fd\u61c9\u7528<code>Test<\/code>\u7d50\u5c3e\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528 <code>phpunit<\/code> \u6216\u00a0<code>php vendor<span class=\"token operator\">\/<\/span>bin<span class=\"token operator\">\/<\/span>phpunit<\/code> \u6307\u4ee4\u4f86\u57f7\u884c\u4f60\u7684\u6e2c\u8a66\u3002\n\n<h4 id=\"the-vendor-directory\"><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-vendor-directory\">The Vendor Directory<\/a><\/h4>\n\n\u6b64\u76ee\u9304\u653e\u7f6e <a href=\"https:\/\/getcomposer.org\/\">Composer<\/a> \u4f9d\u5b58\u8cc7\u6599\u3002\n&nbsp;\n\n<h2 id=\"the-app-directory\"><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-app-directory\">The App Directory<\/a><\/h2>\n\n\u9019\u500b\u76ee\u9304\u662f\u61c9\u7528\u7a0b\u5f0f\u7684\u4e3b\u8981\u90e8\u4efd\uff0c\u6846\u67b6\u4f7f\u7528<a href=\"https:\/\/www.php-fig.org\/psr\/psr-4\/\">PSR-4 autoloading standard<\/a>\u00a0\u4f86\u81ea\u52d5\u8f09\u5165\u9019\u500b\u76ee\u9304\u3002\n<code>app<\/code> \u76ee\u9304\u5305\u542b\u4e86\u5404\u7a2e\u4e0d\u540c\u7684\u5b50\u76ee\u9304\uff0c\u50cf\u662f <code>Console<\/code>,\u00a0<code>Http<\/code>, \u548c<code>Providers<\/code>\uff0c<code>Console<\/code> \u548c <code>Http<\/code> \u76ee\u9304\u5167\u542b\u63d0\u4f9b\u9032\u5165\u61c9\u7528\u7a0b\u5f0f\u6838\u5fc3\u7684API\u3002 HTTP \u5354\u5b9a\u548cCLI \u90fd\u662f\u7528\u4f86\u548c\u61c9\u7528\u7a0b\u5f0f\u4e92\u52d5\u7684\u6a5f\u5236\uff0c\u4f46\u662f\u4e26\u4e0d\u5be6\u969b\u5305\u542b\u61c9\u7528\u7a0b\u5f0f\u908f\u8f2f\u3002\u63db\u53e5\u8a71\u8aaa\uff0c\u6709\u4e8c\u7a2e\u65b9\u5f0f\u767c\u51fa\u547d\u4ee4\u7d66\u61c9\u7528\u7a0b\u5f0f\uff0c <code>Console<\/code> \u76ee\u9304\u5305\u542b\u6240\u6709\u7684Artisan(\u5de5\u5320)\u547d\u4ee4, \u800c<code>Http<\/code> \u76ee\u9304\u5247\u662f\u7528\u4f86\u5305\u542b\u61c9\u7528\u7a0b\u5f0f\u7684\u63a7\u5236\u5668\/controllers, \u4e2d\u4ecb\u8edf\u9ad4\/middleware, \u548c\u8acb\u6c42\/requests\u3002\n\u7576\u4f60\u4f7f\u7528make\u5de5\u5320(artisan)\u547d\u4ee4\u5efa\u7acb\u985e\u5225\u6642\uff0c\u6703\u5728app\u76ee\u9304\u4e0b\u7522\u751f\u5404\u7a2e\u4e0d\u540c\u7684\u5b50\u76ee\u9304\uff0c\u4f8b\u5982\u00a0\uff0c<code>app<span class=\"token operator\">\/<\/span>Jobs<\/code> \u76ee\u9304\u6703\u5728\u4f60\u4f7f\u7528\u00a0<code>make<span class=\"token punctuation\">:<\/span>job<\/code> \u5de5\u5320\/Artisan \u547d\u4ee4\u5efa\u7acb\u4e00\u500bjob\/\u5de5\u4f5c\u985e\u5225\u5f8c\u88ab\u5efa\u7acb\u3002<img decoding=\"async\" src=\"https:\/\/laravel.com\/img\/callouts\/lightbulb.min.svg\" \/>\nMany of the classes in the\u00a0<code>app<\/code> \u76ee\u9304\u4e0b\u7684\u8a31\u591a\u985e\u5225\u53ef\u4ee5\u900f\u904eArtisan\u547d\u4ee4\u5efa\u7acb\uff0c\u53ef\u4ee5\u57f7\u884c<code>php artisan <span class=\"token keyword\">list<\/span> make<\/code> \u547d\u4ee4\u4f86\u77e5\u9053\u53ef\u7528\u7684\u547d\u4ee4\u3002\n\n<h4 id=\"the-broadcasting-directory\"><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-broadcasting-directory\">The Broadcasting Directory<\/a>\u00a0 \u00a0 \u5ee3\u64ad\u76ee\u9304<\/h4>\n\nThe\u00a0<code>Broadcasting<\/code>\u00a0directory contains all of the broadcast channel classes for your application. These classes are generated using the\u00a0<code>make<span class=\"token punctuation\">:<\/span>channel<\/code>\u00a0command. This directory does not exist by default, but will be created for you when you create your first channel. To learn more about channels, check out the documentation on\u00a0<a href=\"https:\/\/laravel.com\/docs\/7.x\/broadcasting\">event broadcasting<\/a>. \u9810\u8a2d\u9019\u500b\u76ee\u9304\u662f\u4e0d\u5b58\u5728\u7684\uff0c\u9664\u975e\u4f60\u57f7\u884c\u4e86make:channel\u547d\u4ee4\u3002\u5728\u4e00\u500b\u983b\u9053\u88cf\uff0c\u4e8b\u4ef6\u53ef\u4ee5\u88ab\u5ee3\u64ad\u2026\n\n<h4 id=\"the-console-directory\"><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-console-directory\">The Console Directory <\/a>\u4e2d\u63a7\u53f0\u76ee\u9304<\/h4>\n\nThe\u00a0<code>Console<\/code>\u00a0directory contains all of the custom Artisan commands for your application. These commands may be generated using the\u00a0<code>make<span class=\"token punctuation\">:<\/span>command<\/code>\u00a0command. This directory also houses your console kernel, which is where your custom Artisan commands are registered and your\u00a0<a href=\"https:\/\/laravel.com\/docs\/7.x\/scheduling\">scheduled tasks<\/a>\u00a0are defined.\n\n<h4 id=\"the-events-directory\"><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-events-directory\">The Events Directory\u00a0 <\/a>\u4e8b\u4ef6\u76ee\u9304<\/h4>\n\nThis directory does not exist by default, but will be created for you by the\u00a0<code>event<span class=\"token punctuation\">:<\/span>generate<\/code>\u00a0and\u00a0<code>make<span class=\"token punctuation\">:<\/span>event<\/code>\u00a0Artisan commands. The\u00a0<code>Events<\/code>\u00a0directory houses\u00a0<a href=\"https:\/\/laravel.com\/docs\/7.x\/events\">event classes<\/a>. Events may be used to alert other parts of your application that a given action has occurred, providing a great deal of flexibility and decoupling.\n\n<h4 id=\"the-exceptions-directory\"><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-exceptions-directory\">The Exceptions Directory\u00a0 <\/a>\u4f8b\u5916\u76ee\u9304<\/h4>\n\n\u9019\u500b\u76ee\u9304\u662f\u7528\u4f86\u653e\u7f6e\u61c9\u7528\u7a0b\u5f0f\u7684\u4f8b\u5916\u8655\u7406\uff0c\u4e5f\u662f\u4e00\u500b\u597d\u7684\u5730\u65b9\u7528\u4f86\u653e\u7f6e\u4efb\u4f55\u4f60\u61c9\u7528\u7a0b\u5f0f\u6240\u4e1f\u51fa\u7684\u4efb\u4f55\u4f8b\u5916\u3002\u5982\u679c\u4f60\u5e0c\u671b\u5ba2\u5236\u5316\u4f8b\u5916\u5982\u4f55\u88ab\u8a18\u9304\u6216\u751f\u6210\uff0c\u4f60\u61c9\u8a72\u4fee\u6539\u9019\u500b\u76ee\u9304\u4e0b\u7684Handler\u985e\u5225\u3002\nThe\u00a0<code>Exceptions<\/code>\u00a0directory contains your application&#8217;s exception handler and is also a good place to place any exceptions thrown by your application. If you would like to customize how your exceptions are logged or rendered, you should modify the\u00a0<code>Handler<\/code> class in this directory.\n\n<h4 id=\"the-http-directory\"><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-http-directory\">The Http Directory<\/a><\/h4>\n\n\u5e7e\u4e4e\u6240\u6709\u7528\u4f86\u8655\u7406\u61c9\u7528\u7a0b\u5f0f\u8acb\u6c42\u7684\u908f\u8f2f\u90fd\u88ab\u653e\u5728\u9019\u500b\u76ee\u9304\u4e2d\u3002\nThe\u00a0<code>Http<\/code> directory contains your controllers, middleware, and form requests. Almost all of the logic to handle requests entering your application will be placed in this directory.\n\n<h4 id=\"the-jobs-directory\"><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-jobs-directory\">The Jobs Directory<\/a><\/h4>\n\n\u9019\u500b\u76ee\u9304\u7528\u4f86\u653e\u7f6e\u61c9\u7528\u7a0b\u5f0f\u7684\u53ef\u6392\u968a\u5de5\u4f5c\uff0c\u61c9\u7528\u7a0b\u5f0f\u7684\u5de5\u4f5c\u53ef\u4ee5\u7528\u6392\u968a\u7684\u65b9\u5f0f\u57f7\u884c\uff0c\u6216\u8005\u5728\u73fe\u6709\u7684\u8acb\u6c42\u751f\u547d\u9031\u671f\u4e2d\u540c\u6b65\u57f7\u884c\u3002\nThis directory does not exist by default, but will be created for you if you execute the\u00a0<code>make<span class=\"token punctuation\">:<\/span>job<\/code>\u00a0Artisan command. The\u00a0<code>Jobs<\/code>\u00a0directory houses the\u00a0<a href=\"https:\/\/laravel.com\/docs\/7.x\/queues\">queueable jobs<\/a> for your application. Jobs may be queued by your application or run synchronously within the current request lifecycle. Jobs that run synchronously during the current request are sometimes referred to as &#8220;commands&#8221; since they are an implementation of the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Command_pattern\">command pattern<\/a>. \u90a3\u4e9b\u540c\u6b65\u57f7\u884c\u7684\u5de5\u4f5c\u6709\u6642\u88ab\u770b\u505a\u662f\u547d\u4ee4\uff0c\u56e0\u70ba\u9019\u4e9b\u5de5\u4f5c\u662f<a href=\"https:\/\/en.wikipedia.org\/wiki\/Command_pattern\">command pattern<\/a>\u7684\u4e00\u500b\u5be6\u4f5c\u3002\n\n<h4 id=\"the-listeners-directory\"><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-listeners-directory\">The Listeners Directory <\/a>\u4e8b\u4ef6\u76e3\u807d\u5668\u76ee\u9304<\/h4>\n\n\u9019\u500b\u76ee\u9304\u5305\u542b\u4e86\u6240\u6709\u4e8b\u4ef6\u7684\u8655\u7406\uff0c\u4e8b\u4ef6\u76e3\u807d\u5668\u63a5\u6536\u5230\u4e00\u500b\u4e8b\u4ef6\u5f8c\uff0c\u6703\u57f7\u884c\u5c0d\u61c9\u65bc\u4e8b\u4ef6\u7684\u8655\u7406\u908f\u8f2f\u3002\nThis directory does not exist by default, but will be created for you if you execute the\u00a0<code>event<span class=\"token punctuation\">:<\/span>generate<\/code>\u00a0or\u00a0<code>make<span class=\"token punctuation\">:<\/span>listener<\/code>\u00a0Artisan commands. The\u00a0<code>Listeners<\/code>\u00a0directory contains the classes that handle your\u00a0<a href=\"https:\/\/laravel.com\/docs\/7.x\/events\">events<\/a>. Event listeners receive an event instance and perform logic in response to the event being fired. For example, a\u00a0<code>UserRegistered<\/code>\u00a0event might be handled by a\u00a0<code>SendWelcomeEmail<\/code>\u00a0listener.\n\n<h4 id=\"the-mail-directory\"><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-mail-directory\">The Mail Directory\u00a0 <\/a>\u90f5\u4ef6\u76ee\u9304<\/h4>\n\n\u9019\u500b\u76ee\u9304\u5305\u542b\u4e86\u6240\u6709\u61c9\u7528\u7a0b\u5f0f\u6240\u767c\u51fa\u7684\u90f5\u4ef6\u3002\nThis directory does not exist by default, but will be created for you if you execute the\u00a0<code>make<span class=\"token punctuation\">:<\/span>mail<\/code>\u00a0Artisan command. The\u00a0<code>Mail<\/code>\u00a0directory contains all of your classes that represent emails sent by your application. Mail objects allow you to encapsulate all of the logic of building an email in a single, simple class that may be sent using the\u00a0<code>Mail<span class=\"token punctuation\">:<\/span><span class=\"token punctuation\">:<\/span>send<\/code> method.\n\n<h4 id=\"the-notifications-directory\"><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-notifications-directory\">The Notifications Directory\u00a0 <\/a>\u00a0\u901a\u77e5\u76ee\u9304<\/h4>\n\n\u9019\u500b\u76ee\u9304\u5305\u542b\u6240\u6709\u7531\u61c9\u7528\u7a0b\u5f0f\u767c\u51fa\u7684\u4ea4\u6613\u901a\u77e5\uff0c\u4f8b\u5982\uff0c\u4e00\u500b\u5728\u61c9\u7528\u7a0b\u5f0f\u5167\u90e8\u767c\u751f\u7684\u4e8b\u4ef6\u901a\u77e5\u3002Lavavel\u7684\u901a\u77e5\u6a5f\u5236\u62bd\u8c61\u5316\u4e86\u5728email, Slack, SMS\uff0c\u6216\u5132\u5b58\u65bc\u4e00\u500b\u8cc7\u6599\u5eab\u4e2d\u7684\u901a\u77e5\u767c\u9001\u3002\nThis directory does not exist by default, but will be created for you if you execute the\u00a0<code>make<span class=\"token punctuation\">:<\/span>notification<\/code>\u00a0Artisan command. The\u00a0<code>Notifications<\/code> directory contains all of the &#8220;transactional&#8221; notifications that are sent by your application, such as simple notifications about events that happen within your application. Laravel&#8217;s notification features abstracts sending notifications over a variety of drivers such as email, Slack, SMS, or stored in a database.\n\n<h4 id=\"the-policies-directory\"><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-policies-directory\">The Policies Directory\u00a0<\/a> \u653f\u7b56\u76ee\u9304<\/h4>\n\nThis directory does not exist by default, but will be created for you if you execute the\u00a0<code>make<span class=\"token punctuation\">:<\/span>policy<\/code>\u00a0Artisan command. The\u00a0<code>Policies<\/code> directory contains the authorization policy classes (\u6388\u6b0a\u653f\u7b56\u985e\u5225) for your application. Policies are used to determine if a user can perform a given action against a resource. For more information, check out the <a href=\"https:\/\/laravel.com\/docs\/7.x\/authorization\">authorization documentation<\/a>.\u00a0 \u9019\u4e9b\u898f\u5247\u7528\u4f86\u6c7a\u5b9a\u4e00\u500b\u4f7f\u7528\u8005\u662f\u5426\u6709\u6b0a\u9650\u5728\u4e00\u500b\u8cc7\u6e90\u4e0a\u57f7\u884c\u52d5\u4f5c\u3002\n\n<h4 id=\"the-providers-directory\"><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-providers-directory\">The Providers Directory <\/a>\u63d0\u4f9b\u8005\u76ee\u9304<\/h4>\n\n\u6b64\u76ee\u9304\u5305\u542b\u4e86\u6240\u6709\u670d\u52d9\u63d0\u4f9b\u8005\u2026\nThe\u00a0<code>Providers<\/code>\u00a0directory contains all of the\u00a0<a href=\"https:\/\/laravel.com\/docs\/7.x\/providers\">service providers<\/a>\u00a0for your application. Service providers bootstrap your application by binding services in the service container, registering events, or performing any other tasks to prepare your application for incoming requests.\nIn a fresh Laravel application, this directory will already contain several providers. You are free to add your own providers to this directory as needed. \u5728\u4e00\u500b\u525b\u5efa\u7acb\u7684Laravel\u61c9\u7528\u7a0b\u5f0f\uff0c\u9019\u500b\u76ee\u9304\u6703\u5305\u542b\u6578\u500b\u63d0\u4f9b\u8005\u3002\u6211\u5011\u53ef\u4ee5\u4f9d\u81ea\u5df1\u7684\u9700\u8981\u4f86\u52a0\u5165\u6240\u9700\u8981\u7684\u63d0\u4f9b\u8005\u3002\n\n<h4 id=\"the-rules-directory\"><a href=\"https:\/\/laravel.com\/docs\/7.x\/structure#the-rules-directory\">The Rules Directory\u00a0 <\/a>\u898f\u5247\u76ee\u9304<\/h4>\n\n<h4>\u6b64\u76ee\u9304\u5305\u542b\u4e86\u61c9\u7528\u7a0b\u5f0f\u5ba2\u5236\u5316\u7684\u78ba\u8a8d\u898f\u5247 (\u8f38\u5165\u8cc7\u6599\u7684\u6b63\u78ba\u6027\u78ba\u8a8d)\u3002<\/h4>\n\nThis directory does not exist by default, but will be created for you if you execute the\u00a0<code>make<span class=\"token punctuation\">:<\/span>rule<\/code>\u00a0Artisan command. The\u00a0<code>Rules<\/code>\u00a0directory contains the custom validation rule objects for your application. Rules are used to encapsulate complicated validation logic in a simple object. For more information, check out the\u00a0<a href=\"https:\/\/laravel.com\/docs\/7.x\/validation\">validation documentation<\/a>.","protected":false},"excerpt":{"rendered":"<p>\u5e95\u4e0b\u8868\u683c\u662f\u5f9eLaravel\u5b98\u65b9\u6587\u4ef6\u8907\u88fd\u904e\u4f86\u76845\u30016\u30017\u7248\u7684\u76ee\u9304\u7d50\u69cb\uff0c\u5b8c\u5168\u4e00\u6a23\uff0c\u6c92 &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","fifu_image_url":"","fifu_image_alt":"","footnotes":""},"categories":[266],"tags":[],"class_list":["post-12150","post","type-post","status-publish","format-standard","hentry","category-266"],"_links":{"self":[{"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/posts\/12150","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/comments?post=12150"}],"version-history":[{"count":1,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/posts\/12150\/revisions"}],"predecessor-version":[{"id":13609,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/posts\/12150\/revisions\/13609"}],"wp:attachment":[{"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/media?parent=12150"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/categories?post=12150"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/tags?post=12150"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}