【发布时间】:2016-05-05 05:11:19
【问题描述】:
我在互联网上搜索了很多,但无法找到答案。我正在使用 Laravel 5,刀片模板几乎没有问题,因为在我的项目中我需要某个时间进行多次扩展,并且我需要将所有数据从一个布局传递到所有主布局“扩展”
嵌套页面示例:
@extends('layouts.full', ['var' => 'key'])
@section('page')
page content here
@stop
layouts/full.blade.php 示例
@extends('app', ['need to pass same data here too'])
@section('content')
@yield('page')
@stop
而 app.blade.php 只是主要的 html 内容
我想问是否有可能在不设置全局变量的情况下传递相同的变量?
@extends('layouts.full', $data = [])
【问题讨论】: