{"id":12149,"date":"2020-05-13T00:00:00","date_gmt":"2020-05-12T16:00:00","guid":{"rendered":"https:\/\/fgchen.com\/wpedu2\/2020\/05\/13\/%e3%80%90%e7%ad%86%e8%a8%98-laravel%e3%80%91laravel%e7%9a%84%e9%a0%81%e9%9d%a2%e8%b7%af%e7%94%b1\/"},"modified":"2026-03-30T14:40:59","modified_gmt":"2026-03-30T06:40:59","slug":"%e3%80%90%e7%ad%86%e8%a8%98-laravel%e3%80%91laravel%e7%9a%84%e9%a0%81%e9%9d%a2%e8%b7%af%e7%94%b1","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%e9%a0%81%e9%9d%a2%e8%b7%af%e7%94%b1\/","title":{"rendered":"\u3010\u7b46\u8a18-Laravel\u3011Laravel\u7684\u9801\u9762\u8def\u7531"},"content":{"rendered":"<h1>\u5efa\u7acb\u6240\u6709\u9801\u9762\u7684\u8def\u7531\uff0c\u7de8\u8f2froutes\/web.php<\/h1>\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">&lt;?php\nuse IlluminateSupportFacadesRoute;\n\/*\n|--------------------------------------------------------------------------\n| Web Routes\n|--------------------------------------------------------------------------\n|\n| Here is where you can register web routes for your application. These\n| routes are loaded by the RouteServiceProvider within a group which\n| contains the \"web\" middleware group. Now create something great!\n|\n*\/\nRoute::get('\/', function () { return view('pages.home'); });\nRoute::get('\/contact', function () { return View('pages.contact'); });<\/pre>\n\n\u4e0a\u9762\u5c07\u9996\u9801(\u7db2\u9801\u6839\u76ee\u9304)\u6307\u5411pages\u4e0b\u7684home.blade.php (\u5728Laravel\u88cf\uff0c\u6a94\u6848\u7d50\u69cb\u8f49\u63db\u6210\u9ede\u7684\u65b9\u5f0f\u8868\u9054\uff0c\u4e26\u4e14\u7701\u7565\u6389\u9644\u5c6c\u6a94\u540dblade.php)\n\/contact\u6307\u5411pages\u4e0b\u7684contact.blade.php\n\u5728\u9019\u500b\u4f8b\u5b50\uff0c\u6211\u5011\u5c07\u6240\u6709\u7684\u9801\u9762\u5206\u5225\u653e\u7f6e\u5728views\u76ee\u9304\u4e0b\u7684pages\u3001includes\u3001layouts\u76ee\u9304\uff1a\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">+---includes\n|       footer.blade.php\n|       head.blade.php\n|       header.blade.php\n|\n+---layouts\n|       default.blade.php\n|\n---pages\n        contact.blade.php\n        home.blade.php\n<\/pre>\n\n\u5e95\u4e0b\uff0c\u6211\u5011\u5c07\u6240\u6709\u7684\u9801\u9762\u5efa\u7acb\u8d77\u4f86\uff1a\n\n<h2>includes\uff1a<\/h2>\n\n<h3><b>head.blade.php<\/b><\/h3>\n\n<div class=\"EnlighterJSWrapper enlighterEnlighterJSWrapper\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\">&lt;!DOCTYPE html&gt;\n&lt;html lang=\"en\"&gt;\n&lt;head&gt;\n  &lt;meta charset=\"UTF-8\"&gt;\n  &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"&gt;\n  &lt;meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\"&gt;\n  &lt;title&gt;Laravel layout example&lt;\/title&gt;\n  &lt;!-- \u5f9eCDN\u8f09\u5165bootstrap --&gt;\n  &lt;link rel=\"stylesheet\" href=\"\/\/netdna.bootstrapcdn.com\/twitter-bootstrap\/3.0.3\/css\/bootstrap-combined.min.css\"&gt;\n&lt;\/head&gt;\n<\/pre>\n<\/div>\n\n<b>header.blade.php<\/b><b>\n<\/b>\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\">&lt;div class=\"navbar\"&gt;\n   &lt;div class=\"navbar-inner\"&gt;\n       &lt;a id=\"logo\" href=\"\/\"&gt;Laravel\u9801\u9762\u8def\u7531\u7bc4\u4f8b&lt;\/a&gt;\n       &lt;ul class=\"nav\"&gt;\n           &lt;li&gt;&lt;a href=\"\/\"&gt;\u9996\u9801&lt;\/a&gt;&lt;\/li&gt;\n           &lt;li&gt;&lt;a href=\"\/contact\"&gt;\u8207\u6211\u806f\u7e6b&lt;\/a&gt;&lt;\/li&gt;\n       &lt;\/ul&gt;\n   &lt;\/div&gt;\n&lt;\/div&gt;\n<\/pre>\n\n<b>footer.blade.php<\/b>\n\n<div class=\"EnlighterJSWrapper enlighterEnlighterJSWrapper\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\">&lt;div id=\"copyright text-right\"&gt;\u00a9 Copyright 2020 \u9673\u5bcc\u570b \u5f18\u5149\u79d1\u6280\u5927\u5b78 \u8cc7\u8a0a\u7ba1\u7406\u7cfb&lt;\/div&gt;\n<\/pre>\n<h2>layouts\uff1a<\/h2>\n<strong>default.blade.php<\/strong>\n<\/div>\n\n<div class=\"EnlighterJSWrapper enlighterEnlighterJSWrapper\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\">&lt;!doctype html&gt;\n&lt;html&gt;\n&lt;head&gt;\n   @include('includes.head')\n&lt;\/head&gt;\n&lt;body&gt;\n&lt;div class=\"container\"&gt;\n   &lt;header class=\"row\"&gt;\n       @include('includes.header')\n   &lt;\/header&gt;\n   &lt;div id=\"main\" class=\"row\"&gt;\n           @yield('content')\n   &lt;\/div&gt;\n   &lt;footer class=\"row\"&gt;\n       @include('includes.footer')\n   &lt;\/footer&gt;\n&lt;\/div&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;<\/pre>\n<h2>pages\uff1a<\/h2>\n<b>home.blade.php<\/b>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\">@extends('layouts.default')\n@section('content')\n   &lt;h1&gt;\u73fe\u5728\u9019\u500b\u9801\u9762\u662f\u300c\u9996\u9801\u300d\u9801\u9762&lt;\/h1&gt;\n@stop\n<\/pre>\n<b>contact.blade.php<\/b>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\">@extends('layouts.default')\n@section('content')\n   &lt;h1&gt;\u73fe\u5728\u9019\u500b\u9801\u9762\u662f\u300c\u8207\u6211\u806f\u7e6b\u300d\u9801\u9762&lt;\/h1&gt;\n@stop\n<\/pre>\n&nbsp;\n<\/div>\n\n<h1>\u7d50\u679c\uff1a<\/h1>\n\n<a href=\"https:\/\/fgchen.com\/wp\/wp-content\/uploads\/2020\/05\/lavavel-view-example-1.png\"><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-full wp-image-16246\" src=\"https:\/\/fgchen.com\/wp\/wp-content\/uploads\/2020\/05\/lavavel-view-example-1.png\" alt=\"\" width=\"1044\" height=\"351\" \/><\/a>\n<a href=\"https:\/\/fgchen.com\/wp\/wp-content\/uploads\/2020\/05\/lavavel-view-example-2.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-16247\" src=\"https:\/\/fgchen.com\/wp\/wp-content\/uploads\/2020\/05\/lavavel-view-example-2.png\" alt=\"\" width=\"1044\" height=\"351\" \/><\/a>","protected":false},"excerpt":{"rendered":"<p>\u5efa\u7acb\u6240\u6709\u9801\u9762\u7684\u8def\u7531\uff0c\u7de8\u8f2froutes\/web.php &lt;?php use  &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-12149","post","type-post","status-publish","format-standard","hentry","category-266"],"_links":{"self":[{"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/posts\/12149","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=12149"}],"version-history":[{"count":1,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/posts\/12149\/revisions"}],"predecessor-version":[{"id":13443,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/posts\/12149\/revisions\/13443"}],"wp:attachment":[{"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/media?parent=12149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/categories?post=12149"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/tags?post=12149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}