Laravel Blade 模板 @section/endsection 與 @section/show, @yield 的區別


base layout 中需要使用

@section("section_name") 區塊鏈是什么? @show 

繼承的 blade 中需要使用

@section("section_name") 區塊鏈的定義 @endsection 

其會覆蓋父模板中的內容。

如果需要基於原 layout section 附加內容

@section("section_name") @parent <p>區塊鏈是xxx</p> @endsection 

@yield 類似於 @section/show 的用法,但是其繼承者不能使用 @parent。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM