{"id":832,"date":"2025-06-12T00:44:37","date_gmt":"2025-06-11T16:44:37","guid":{"rendered":"https:\/\/www.zhaozhao123.cn\/php\/php-application-manual\/laravel\/832.html"},"modified":"2025-06-12T00:44:37","modified_gmt":"2025-06-11T16:44:37","slug":"laravel-blade%ef%bc%9a%e5%a6%82%e4%bd%95%e8%ae%bf%e9%97%ae%e7%88%b6%e8%a7%86%e5%9b%be%e4%b8%ad%e7%9a%84%e6%95%b0%e6%8d%ae","status":"publish","type":"my1js","link":"https:\/\/www.zhaozhao123.cn\/php\/my1js\/832.html","title":{"rendered":"Laravel Blade\uff1a\u5982\u4f55\u8bbf\u95ee\u7236\u89c6\u56fe\u4e2d\u7684\u6570\u636e"},"content":{"rendered":"<div class=\"wp-block-columns p-0 border is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-columns px-4 py-3 border-bottom has-background is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\" style=\"background:linear-gradient(243deg,rgb(238,238,238) 0%,rgba(58,166,242,0.15) 100%)\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-6c531013 wp-block-group-is-layout-flex\">\r\n<figure class=\"wp-block-image size-thumbnail is-resized is-style-rounded is-style-rounded--1\"><img decoding=\"async\" src=\"https:\/\/www.zhaozhao123.cn\/myitems\/images\/sites16\/2025\/06\/dyA-1-400x300.jpg\" alt=\"Bug&#32534;&#35793;&#29422;\" class=\"wp-image-1842\" style=\"object-fit:cover;width:30px;height:30px\"><\/figure>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading my-0\" style=\"font-size:clamp(0.875rem, 0.875rem + ((1vw - 0.2rem) * 0.175), 1rem);\">Bug&#32534;&#35793;&#29422;<\/h2>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n\r\n\r\n\r\n<div class=\"wp-block-columns px-xl-5 px-4 py-xl-4 py-3 is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<p>&#22312; Laravel &#20013;&#65292;&#22914;&#26524;&#20320;&#24819;&#35201;&#22312;&#23376;&#35270;&#22270;&#20013;&#35775;&#38382;&#29238;&#35270;&#22270;&#20013;&#30340;&#25968;&#25454;&#65292;&#21487;&#20197;&#20351;&#29992; <code>@include<\/code> &#25351;&#20196;&#26469;&#23454;&#29616;&#12290;&#20197;&#19979;&#26159;&#19968;&#20010;&#31616;&#21333;&#30340;&#31034;&#20363;&#65292;&#23637;&#31034;&#20102;&#22914;&#20309;&#22312;&#23376;&#35270;&#22270;&#20013;&#35775;&#38382;&#29238;&#35270;&#22270;&#20013;&#30340;&#25968;&#25454;&#12290;<\/p>\n<h3>&#29238;&#35270;&#22270;&#65288;parent.blade.php&#65289;<\/h3>\n<pre><code class=\"language-blade\">&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;title&gt;Parent View&lt;\/title&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n    &lt;h1&gt;Welcome to the Parent View&lt;\/h1&gt;\n\n    &lt;!-- Include the child view --&gt;\n    @include('child', ['message' =&gt; 'Hello from the parent'])\n&lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n<h3>&#23376;&#35270;&#22270;&#65288;child.blade.php&#65289;<\/h3>\n<pre><code class=\"language-blade\">&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;title&gt;Child View&lt;\/title&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n    &lt;h2&gt;Hello from the Child View&lt;\/h2&gt;\n\n    &lt;!-- Access data from the parent view --&gt;\n    &lt;p&gt;{{ $message }}&lt;\/p&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n<p>&#22312;&#36825;&#20010;&#31034;&#20363;&#20013;&#65292;&#25105;&#20204;&#20351;&#29992;&#20102; <code>@include<\/code> &#25351;&#20196;&#23558; <code>child.blade.php<\/code> &#21253;&#21547;&#21040; <code>parent.blade.php<\/code> &#20013;&#65292;&#24182;&#20256;&#36882;&#20102;&#19968;&#20010;&#21517;&#20026; <code>message<\/code> &#30340;&#21464;&#37327;&#32473;&#23376;&#35270;&#22270;&#12290;&#22312;&#23376;&#35270;&#22270;&#20013;&#65292;&#25105;&#20204;&#21487;&#20197;&#20351;&#29992; <code>$message<\/code> &#21464;&#37327;&#26469;&#35775;&#38382;&#21644;&#26174;&#31034;&#36825;&#20010;&#20540;&#12290;<\/p>\n<h3>&#31034;&#20363;&#20195;&#30721;<\/h3>\n<p>&#20197;&#19979;&#26159;&#19968;&#20010;&#23436;&#25972;&#30340;&#31034;&#20363;&#20195;&#30721;&#65292;&#23637;&#31034;&#20102;&#22914;&#20309;&#22312; Laravel &#20013;&#20351;&#29992; <code>@include<\/code> &#25351;&#20196;&#26469;&#35775;&#38382;&#29238;&#35270;&#22270;&#20013;&#30340;&#25968;&#25454;&#65306;<\/p>\n<h4><code>app\/views\/parent.blade.php<\/code><\/h4>\n<pre><code class=\"language-php\">&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;title&gt;Parent View&lt;\/title&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n    &lt;h1&gt;Welcome to the Parent View&lt;\/h1&gt;\n\n    &lt;!-- Include the child view with a message --&gt;\n    @include('child', ['message' =&gt; 'Hello from the parent'])\n\n    &lt;!-- Additional content in the parent view --&gt;\n    &lt;p&gt;This is additional content in the parent view.&lt;\/p&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n<h4><code>app\/views\/child.blade.php<\/code><\/h4>\n<pre><code class=\"language-php\">&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;title&gt;Child View&lt;\/title&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n    &lt;h2&gt;Hello from the Child View&lt;\/h2&gt;\n\n    &lt;!-- Access data from the parent view --&gt;\n    &lt;p&gt;{{ $message }}&lt;\/p&gt;\n\n    &lt;!-- Additional content in the child view --&gt;\n    &lt;p&gt;This is additional content in the child view.&lt;\/p&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n<p>&#36890;&#36807;&#36825;&#31181;&#26041;&#24335;&#65292;&#20320;&#21487;&#20197;&#36731;&#26494;&#22320;&#22312;&#23376;&#35270;&#22270;&#20013;&#35775;&#38382;&#21644;&#20351;&#29992;&#29238;&#35270;&#22270;&#20013;&#30340;&#25968;&#25454;&#12290;<\/p>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div><div class=\"wp-block-columns p-0 border is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-columns px-4 py-3 border-bottom has-background is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\" style=\"background:linear-gradient(243deg,rgb(238,238,238) 0%,rgba(58,166,242,0.15) 100%)\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-6c531013 wp-block-group-is-layout-flex\">\r\n<figure class=\"wp-block-image size-thumbnail is-resized is-style-rounded is-style-rounded--2\"><img decoding=\"async\" src=\"https:\/\/www.zhaozhao123.cn\/myitems\/images\/sites16\/2025\/06\/zp-400x300.jpg\" alt=\"&#40657;&#26495;Bug&#35762;&#24072;\" class=\"wp-image-1849\" style=\"object-fit:cover;width:30px;height:30px\"><\/figure>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading my-0\" style=\"font-size:clamp(0.875rem, 0.875rem + ((1vw - 0.2rem) * 0.175), 1rem);\">&#40657;&#26495;Bug&#35762;&#24072;<\/h2>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n\r\n\r\n\r\n<div class=\"wp-block-columns px-xl-5 px-4 py-xl-4 py-3 is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<body><h2>&#20171;&#32461;<\/h2><p>Laravel Blade &#26159; Laravel &#25552;&#20379;&#30340;&#24378;&#22823;&#27169;&#26495;&#24341;&#25806;&#65292;&#36825;&#26159;&#27969;&#34892; PHP &#26694;&#26550;&#20043;&#19968;&#12290;&#36825;&#20010;&#24341;&#25806;&#20801;&#35768;&#24320;&#21457;&#20154;&#21592;&#26080;&#32541;&#22320;&#23558; PHP &#20195;&#30721;&#19982; HTML &#32467;&#21512;&#22312;&#19968;&#36215;&#65292;&#20351;&#29983;&#25104;&#29992;&#20110; Web &#24212;&#29992;&#31243;&#24207;&#30340;&#21160;&#24577;&#20869;&#23481;&#21464;&#24471;&#26356;&#21152;&#23481;&#26131;&#12290;&#24403;&#20351;&#29992; Laravel Blade &#26102;&#65292;&#35775;&#38382;&#29238;&#35270;&#22270;&#20013;&#30340;&#25968;&#25454;&#20174;&#23376;&#35270;&#22270;&#65288;&#20363;&#22914;&#20351;&#29992;&#24067;&#23616;&#21644;&#32452;&#20214;&#65289;&#30340;&#38656;&#27714;&#24456;&#24120;&#35265;&#12290;<\/p><p>&#36825;&#31687;&#25991;&#31456;&#23558;&#20026;&#24744;&#25552;&#20379;&#22914;&#20309;&#22312;Laravel Blade&#27169;&#26495;&#20013;&#35775;&#38382;&#29238;&#35270;&#22270;&#25968;&#25454;&#30340;&#27493;&#39588;&#25351;&#21335;&#12290;&#25105;&#20204;&#23558;&#20174;Blade&#27169;&#26495;&#30340;&#22522;&#30784;&#24320;&#22987;&#65292;&#36880;&#27493;&#28145;&#20837;&#21040;&#26356;&#39640;&#32423;&#30340;&#25216;&#26415;&#12290;&#25105;&#20204;&#36824;&#23558;&#21253;&#25324;&#20960;&#20010;&#20195;&#30721;&#31034;&#20363;&#65292;&#20197;&#24110;&#21161;&#21152;&#28145;&#24744;&#30340;&#29702;&#35299;&#12290;<\/p><h2>&#29702;&#35299;&#20995;&#35270;&#22270;&#21644;&#25968;&#25454;&#20849;&#20139;<\/h2><p>&#22312;Laravel&#20013;&#65292;&#8221;&#35270;&#22270;&#8221;&#26159;&#25351;&#30001;&#24212;&#29992;&#31243;&#24207;&#26381;&#21153;&#30340;HTML&#12290;&#35270;&#22270;&#21487;&#20197;&#20174;&#35843;&#29992;&#23427;&#20204;&#30340;&#25511;&#21046;&#22120;&#32487;&#25215;&#25968;&#25454;&#25110;&#30452;&#25509;&#20174;&#36335;&#30001;&#33719;&#21462;&#12290;&#27492;&#22806;&#65292;Blade&#35270;&#22270;&#21487;&#20197;&#32452;&#32455;&#20026;&#23618;&#27425;&#32467;&#26500;&#24067;&#23616;&#65292;&#22312;&#20854;&#20013;&#23376;&#35270;&#22270;&#36890;&#36807;&#20351;&#29992;&#35832;&#22914;extends&#36825;&#26679;&#30340;&#25351;&#20196;&#20174;&#29238;&#35270;&#22270;&#25193;&#23637;&#12290;<code>@extends<\/code>and &#26159;&#20013;&#25991;&#20013;&#30340;&ldquo;&#21644;&rdquo;&#65292;&#34920;&#31034;&#24182;&#21015;&#25110;&#32852;&#21512;&#30340;&#24847;&#24605;&#12290;<code>@include<\/code>&#22909;&#30340;&#65292;&#35831;&#25552;&#20379;&#38656;&#35201;&#32763;&#35793;&#30340;&#20869;&#23481;&#12290;<\/p><p>&#25968;&#25454;&#36890;&#24120;&#36890;&#36807;&#35270;&#22270;&#19982;&#29992;&#25143;&#20849;&#20139;&#12290;<code>view<\/code>&#30001;&#25511;&#21046;&#22120;&#25110;&#36335;&#30001;&#25552;&#20379;&#30340;&#26041;&#27861;&#12290;&#20363;&#22914;&#65306;<\/p><pre><code>$data = ['key' =&gt; 'value'];\nreturn view('view.name', compact('data'));<\/code><\/pre><p>&#22312;&#19978;&#36848;&#31034;&#20363;&#20013;&#65292;&#25968;&#25454;&#25968;&#32452;&#34987;&#20256;&#36882;&#21040;&#35270;&#22270;&#12290;<code>compact<\/code>&#20989;&#25968;&#21487;&#20197;&#24555;&#36895;&#29983;&#25104;&#20351;&#29992;&#21464;&#37327;&#21517;&#20316;&#20026;&#38190;&#30340;&#25968;&#32452;&#12290;<\/p><h2>&#24310;&#38271;&#29238;&#35270;&#22270;<\/h2><p>&#23376;&#35270;&#22270;&#65292;&#20063;&#31216;&#20026;&ldquo;&#23376;&#35270;&#22270;&rdquo;&#65292;&#21487;&#20197;&#36890;&#36807;&#25193;&#23637;&#24067;&#23616;&#26469;&#20351;&#29992;&#12290;<code>@extends<\/code>&#25252;&#30462;&#25351;&#20196;&#12290;&#36825;&#20250;&#35774;&#32622;&#19968;&#31181;&#20851;&#31995;&#65292;&#20351;&#24471;&#23376;&#35270;&#22270;&#21487;&#20197;&#25554;&#20837;&#21040;&#29238;&#24067;&#23616;&#20013;&#12290;<\/p><pre><code>\/\/ resources\/views\/layouts\/master.blade.php\n&lt;html&gt;\n  &lt;head&gt;&lt;\/head&gt;\n  &lt;body&gt;\n    @yield('content')\n  &lt;\/body&gt;\n&lt;\/html&gt;\n\n\/\/ resources\/views\/page.blade.php\n@extends('layouts.master')\n\n@section('content')\n  \/\/ your content here\n@endsection<\/code><\/pre><p>&#22312;&#19978;&#36848;&#20363;&#23376;&#20013;&#65292;<code>page.blade.php<\/code>&#35270;&#22270;&#65288;View&#65289;&#25193;&#23637;&#20102;&#12290;<code>master.blade.php<\/code>&#24067;&#23616;&#24182;&#23558;&#20854;&#20869;&#23481;&#27880;&#20837;&#21040;&#12290;<code>@yield('content')<\/code>&#35813;&#37096;&#20998;&#23646;&#20110;&#23478;&#38271;&#30340;&#37096;&#20998;&#12290;<\/p><h2>&#20256;&#36882;&#25968;&#25454;&#21040;&#24067;&#23616;<\/h2><p>&#20219;&#20309;&#30001;&#23376;&#35270;&#22270;&#32487;&#25215;&#30340;&#25968;&#25454;&#65292;&#37117;&#20250;&#33258;&#21160;&#21487;&#35775;&#38382;&#21040;&#20854;&#29238;&#25511;&#20214;&#12290;&#20294;&#26159;&#25968;&#25454;&#24517;&#39035;&#39318;&#20808;&#20174;&#25511;&#21046;&#22120;&#20256;&#36882;&#21040;&#35270;&#22270;&#65306;<\/p><pre><code>public function show($id)\n{\n  $item = Item::findOrFail($id);\n  return view('items.show', compact('item'));\n}<\/code><\/pre><p>&#22312;&#36825;&#31181;&#24773;&#20917;&#19979;&#65292;&#30340;<code>item<\/code>&#21464;&#37327;&#19981;&#20165;&#21487;&#20197;&#22312;&#20316;&#29992;&#22495;&#20869;&#35775;&#38382;&#65292;&#36824;&#21487;&#20197;&#22312;&#20316;&#29992;&#22495;&#22806;&#35775;&#38382;&#12290;<code>items.show<\/code>&#27983;&#35272;&#65292;&#20063;&#21253;&#25324;<code>layouts.master<\/code>&#24067;&#23616;&#24050;&#32463;&#35774;&#32622;&#22909;&#20102;&#12290;<code>items.show<\/code>&#32487;&#32493;&#12290;<\/p><h2>&#20351;&#29992;&#32452;&#20214;&#21644;&#27133;<\/h2><p>&#22312;Laravel 5.4&#20013;&#24341;&#20837;&#30340;&#32452;&#20214;&#21644;&#21344;&#20301;&#31526;&#25552;&#20379;&#20102;&#20174;&#19981;&#21516;&#37096;&#20998;&#32452;&#35013;&#35270;&#22270;&#30340;&#26041;&#27861;&#65292;&#20174;&#32780;&#25552;&#39640;&#21487;&#37325;&#29992;&#24615;&#12290;<code>@component<\/code>&#25351;&#20196;&#21019;&#24314;&#20102;&#19968;&#20010;&#32452;&#20214;&#65292;&#35813;&#32452;&#20214;&#21487;&#20197;&#21253;&#21547;&#19968;&#20010;<code>@slot<\/code>&#25351;&#20196;&#25351;&#23450;&#21160;&#24577;&#20869;&#23481;&#21306;&#22495;&#12290;<\/p><pre><code>\/\/ resources\/views\/components\/alert.blade.php\n&lt;div class=\"alert alert-{{ $type }}&gt;\n  {{ $slot }}\n&lt;\/div&gt;<\/code><\/pre><p>&#19968;&#20010;&#29238;&#35270;&#22270;&#21487;&#20197;&#20351;&#29992;&#32452;&#20214;&#24182;&#20256;&#36882;&#25968;&#25454;&#21040;&#23427;&#65306;<\/p><pre><code>@component('components.alert', ['type' =&gt; 'danger'])\n  There was a problem with your input.\n@endcomponent<\/code><\/pre><p>&#23545;&#19981;&#36215;&#65292;&#25105;&#26080;&#27861;&#29702;&#35299;&#36825;&#21477;&#35805;&#30340;&#24847;&#24605;&#12290;<code>type<\/code>&#21464;&#37327;&#20174;&#29238;&#35270;&#22270;&#20256;&#36882;&#21040;&#32452;&#20214;&#65292;&#32780;&#32452;&#20214;&#20869;&#30340;&#20869;&#23481;&#21017;&#34987;&#20256;&#36882;&#20986;&#21435;&#12290;<code>$slot<\/code>&#24050;&#32463;&#25910;&#21040;&#25351;&#20196;&#65292;&#31561;&#24453;&#19979;&#19968;&#27493;&#25351;&#31034;&#12290;<\/p><h2>&#22312;&#25152;&#26377;&#35270;&#22270;&#20043;&#38388;&#20849;&#20139;&#25968;&#25454;&#12290;<\/h2><p>&#26377;&#26102;&#65292;&#24744;&#21487;&#33021;&#24076;&#26395;&#22312;&#24212;&#29992;&#31243;&#24207;&#30340;&#25152;&#26377;&#35270;&#22270;&#20043;&#38388;&#20849;&#20139;&#25968;&#25454;&#32780;&#26080;&#38656;&#25163;&#21160;&#27599;&#27425;&#20256;&#36882;&#25968;&#25454;&#12290;Laravel &#25552;&#20379;&#20102;&#19968;&#31181;&#26041;&#20415;&#30340;&#26041;&#27861;&#26469;&#23454;&#29616;&#36825;&#19968;&#28857;&#12290;<code>view()-&gt;share()<\/code>&#26041;&#27861;&#12290;<\/p><pre><code>\/\/ AppServiceProvider.php\npublic function boot()\n{\n  view()-&gt;share('key', 'value');\n}<\/code><\/pre><p>&#19968;&#26086;&#25968;&#25454;&#20197;&#36825;&#31181;&#26041;&#24335;&#20849;&#20139;&#65292;&#23427;&#23558;&#22312;&#24212;&#29992;&#31243;&#24207;&#28210;&#26579;&#30340;&#27599;&#20010;&#35270;&#22270;&#20013;&#21487;&#29992;&#65292;&#21253;&#25324;&#29238;&#24067;&#23616;&#12289;&#23376;&#35270;&#22270;&#21644;&#32452;&#20214;&#12290;<\/p><h2>&#20351;&#29992;&#35270;&#22270;&#25511;&#21046;&#22120;&#65288;View Composers&#65289;<\/h2><p>&#35270;&#22270;&#32534;&#25490;&#32773;&#26159;&#22238;&#35843;&#20989;&#25968;&#25110;&#31867;&#26041;&#27861;&#65292;&#24403;&#35270;&#22270;&#34987;&#28210;&#26579;&#26102;&#35843;&#29992;&#12290;&#22914;&#26524;&#20320;&#26377;&#25968;&#25454;&#38656;&#35201;&#32465;&#23450;&#21040;&#27599;&#27425;&#28210;&#26579;&#30340;&#35270;&#22270;&#19978;&#65292;&#20320;&#21487;&#20197;&#20351;&#29992;&#35270;&#22270;&#32534;&#25490;&#32773;&#26469;&#22312;&#19968;&#20010;&#22320;&#26041;&#32452;&#32455;&#36923;&#36753;&#12290;<\/p><pre><code>view()-&gt;composer('*', function ($view) {\n    $view-&gt;with('sharedData', 'This is shared data for every view.');\n});<\/code><\/pre><p>&#35813;&#31034;&#20363;&#20351;&#29992;&#35270;&#22270;&#32452;&#21512;&#22120;&#26469;&#19982;&#24212;&#29992;&#28210;&#26579;&#30340;&#25152;&#26377;&#35270;&#22270;&#20849;&#20139;&#25968;&#25454;&#12290;&#26143;&#21495;&#24847;&#21619;&#30528;&#32452;&#21512;&#22120;&#23558;&#22312;&#25152;&#26377;&#35270;&#22270;&#19978;&#34987;&#35843;&#29992;&#12290;<\/p><h2>&#32467;&#35770;<\/h2><p>&#24635;&#32467;&#19968;&#19979;&#65292;&#29238;&#35270;&#22270;&#21644;&#23376;&#35270;&#22270;&#20013;&#30340;&#25968;&#25454;&#20849;&#20139;&#19982;&#35775;&#38382;&#38750;&#24120;&#31616;&#21333;&#19988;&#20855;&#26377;&#24378;&#22823;&#21151;&#33021;&#30340;&#29305;&#24615;&#30001;Laravel Blade&#25552;&#20379;&#12290;&#26080;&#35770;&#26159;&#20174;&#25511;&#21046;&#22120;&#36820;&#22238;&#35270;&#22270;&#26102;&#30452;&#25509;&#20998;&#20139;&#25968;&#25454;&#65292;&#36824;&#26159;&#20351;&#29992;&#32452;&#20214;&#21644;&#27133;&#26469;&#26500;&#24314;&#26356;&#27169;&#22359;&#21270;&#30340;&#27169;&#26495;&#65292;&#37117;&#21487;&#20197;&#21033;&#29992;&#20840;&#23616;&#25968;&#25454;&#20849;&#20139;&#12290;<code>view()-&gt;share()<\/code>&#65292;&#25110;&#32773;&#21033;&#29992;&#35270;&#22270;&#32534;&#35793;&#22120;&#65292;Laravel &#25552;&#20379;&#20102;&#22810;&#31181;&#24037;&#20855;&#20379;&#24744;&#20351;&#29992;&#12290;<\/p><p>&#29702;&#35299;&#36825;&#20123;&#27010;&#24565;&#21518;&#65292;&#24744;&#23558;&#26356;&#22909;&#22320;&#31649;&#29702;&#24212;&#29992;&#31243;&#24207;&#20013;&#30340;&#25968;&#25454;&#27969;&#65292;&#20174;&#32780;&#32534;&#20889;&#26356;&#24178;&#20928;&#12289;&#21487;&#32500;&#25252;&#21644;&#25193;&#23637;&#30340;&#20195;&#30721;&#12290;&#22987;&#32456;&#30830;&#20445;&#38405;&#35835;Laravel&#25991;&#26723;&#20197;&#33719;&#21462;&#26368;&#26032;&#21151;&#33021;&#21644;Blade&#27169;&#26495;&#24341;&#25806;&#26356;&#26032;&#12290;<\/p><\/body>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div><div class=\"wp-block-columns p-0 border is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-columns px-4 py-3 border-bottom has-background is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\" style=\"background:linear-gradient(243deg,rgb(238,238,238) 0%,rgba(58,166,242,0.15) 100%)\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-6c531013 wp-block-group-is-layout-flex\">\r\n<figure class=\"wp-block-image size-thumbnail is-resized is-style-rounded is-style-rounded--3\"><img decoding=\"async\" src=\"https:\/\/www.zhaozhao123.cn\/myitems\/images\/sites16\/2025\/06\/xygcfznnzczhsdmwydzhsmzzzmddnq-400x300.jpg\" alt=\"&#38271;&#24037;&#30721;&#22900;1523\" class=\"wp-image-2906\" style=\"object-fit:cover;width:30px;height:30px\"><\/figure>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading my-0\" style=\"font-size:clamp(0.875rem, 0.875rem + ((1vw - 0.2rem) * 0.175), 1rem);\">&#38271;&#24037;&#30721;&#22900;1523<\/h2>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n\r\n\r\n\r\n<div class=\"wp-block-columns px-xl-5 px-4 py-xl-4 py-3 is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<p>&#22312; Laravel &#20013;&#65292;&#20320;&#21487;&#20197;&#20351;&#29992; <code>@parent<\/code> &#25351;&#20196;&#26469;&#35775;&#38382;&#29238;&#35270;&#22270;&#20013;&#30340;&#25968;&#25454;&#12290;&#36825;&#36890;&#24120;&#29992;&#20110;&#22788;&#29702;&#36335;&#30001;&#30340;&#21305;&#37197;&#21644;&#35831;&#27714;&#30340;&#22788;&#29702;&#12290;<\/p>\n<p>&#20363;&#22914;&#65292;&#20551;&#35774;&#25105;&#20204;&#26377;&#19968;&#20010;&#21517;&#20026; <code>Home.blade.php<\/code> &#30340;&#35270;&#22270;&#25991;&#20214;&#65292;&#24182;&#19988;&#25105;&#20204;&#38656;&#35201;&#20174;&#21478;&#19968;&#20010;&#21517;&#20026; <code>About.blade.php<\/code> &#30340;&#35270;&#22270;&#25991;&#20214;&#20013;&#33719;&#21462;&#25968;&#25454;&#65306;<\/p>\n<ol>\n<li>&#39318;&#20808;&#65292;&#30830;&#20445;&#36825;&#20004;&#20010;&#25991;&#20214;&#37117;&#22312;&#21516;&#19968;&#20010;&#24212;&#29992;&#30446;&#24405;&#19979;&#12290;<\/li>\n<li>&#22312; <code>Home.blade.php<\/code> &#25991;&#20214;&#20013;&#65292;&#20351;&#29992; <code>@extends('layouts.app')<\/code> &#26469;&#32487;&#25215; <code>AppHttpControllersController<\/code> &#30340;&#24067;&#23616;&#12290;<\/li>\n<li>&#28982;&#21518;&#65292;&#22312; <code>Home.blade.php<\/code> &#25991;&#20214;&#20013;&#28155;&#21152; <code>@section('content')<\/code> &#20197;&#20415;&#23884;&#22871; <code>@extends('layouts.app')<\/code> &#21644; <code>@section('content')<\/code> &#20043;&#38388;&#30340;&#20195;&#30721;&#22359;&#12290;<\/li>\n<li>&#25509;&#19979;&#26469;&#65292;&#25105;&#20204;&#21487;&#20197;&#20351;&#29992; <code>@yield('about')\"<\/code> &#25351;&#20196;&#26469;&#24341;&#29992; <code>About.blade.php<\/code> &#25991;&#20214;&#30340;&#20869;&#23481;&#12290;<\/li>\n<li>&#26368;&#21518;&#65292;&#25105;&#20204;&#21487;&#20197;&#22312; <code>Home.blade.php<\/code> &#25991;&#20214;&#20013;&#20351;&#29992; <code>{{ $data }}<\/code> &#25110;&#32773; <code>{{ $this-&gt;data }}<\/code> &#26469;&#35775;&#38382;&#29238;&#35270;&#22270;&#20013;&#30340;&#25968;&#25454;&#12290;<\/li>\n<\/ol>\n<p>&#20197;&#19979;&#26159;&#19968;&#20010;&#31616;&#21333;&#30340;&#31034;&#20363;&#65306;<\/p>\n<pre><code class=\"language-php\">&lt;?php\n\nnamespace AppHttpViewComposers;\n\nuse IlluminateViewView;\nuse AppModelsUser;\n\nclass AboutComposer\n{\n    public function compose(View $view)\n    {\n        $view-&gt;with('data', User::find(1));\n    }\n}<\/code><\/pre>\n<p>&#22312;&#36825;&#20010;&#20363;&#23376;&#20013;&#65292;&#24403;&#25105;&#20204;&#28210;&#26579; <code>Home.blade.php<\/code> &#26102;&#65292;<code>$data<\/code> &#21464;&#37327;&#23558;&#21253;&#21547;&#29992;&#25143;&#27169;&#22411;&#23454;&#20363; <code>User<\/code> &#30340;&#20449;&#24687;&#12290;<\/p>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Bug&#32534;&#35793;&#29422; &#22312; Laravel &#20013;&#65292;&#22914;&#26524;&#20320;&#24819;&#35201;&#22312;&#23376;&#35270;&#22270;&#20013;&#35775;&#38382;&#038;#2..<\/p>\n","protected":false},"author":1,"featured_media":0,"menu_order":0,"template":"","meta":{"_acf_changed":false},"tags":[],"my1js2nav":[44],"tuisongtax":[],"class_list":["post-832","my1js","type-my1js","status-publish","hentry","my1js2nav-laravel"],"acf":{"qian_art_seotitle":"","qian_art_seotitle_source":{"label":"SEO\u6807\u9898","type":"text","formatted_value":""},"qian_art_seokws":"","qian_art_seokws_source":{"label":"SEO\u5173\u952e\u8bcd","type":"text","formatted_value":""},"qian_art_stzhong":"","qian_art_stzhong_source":{"label":"\u4e2d | \u77ed\u6807\u9898","type":"text","formatted_value":""}},"_links":{"self":[{"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/my1js\/832","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/my1js"}],"about":[{"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/types\/my1js"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/users\/1"}],"wp:attachment":[{"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/media?parent=832"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/tags?post=832"},{"taxonomy":"my1js2nav","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/my1js2nav?post=832"},{"taxonomy":"tuisongtax","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/tuisongtax?post=832"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}