如何在不同目录中包含刀片模板? [英] How to include a blade template in different directory?
本文介绍了如何在不同目录中包含刀片模板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经在尝试遵循文档教程.但是,我总是遇到错误,而且我不知道如何解决
I was already trying to follow the documentation tutorial. But, I always get an error, and I don't know how to solve it
如何在其他目录中包含刀片服务器模板?
How can I include a blade template in a different directory?
Dashboard.blade.php =在文件夹views/admin中 Landingpage.blade.php =在文件夹views/admin/subpage中
Dashboard.blade.php = in folder views/admin Landingpage.blade.php = in folder views/admin/subpage
推荐答案
@include
指令允许您从另一个视图中包含Blade视图.
The @include
directive allows you to include a Blade view from within another view.
//resources/views/admin/dashboard.blade.php
@include('admin.dashboard')
//resources/views/admin/subpage/landingpage.blade.php
@include('admin.subpage.landingpage')
您还可以将数据传递到包含的视图中.
You can also pass data into the included views.
@include('admin.dashboard', ['user' => $user])
这篇关于如何在不同目录中包含刀片模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文