在L4中可以在controller中定义 $layout模板,然后在请求中使用
$this->layout->content = View::make(sth view)
今天在L5.3中使用不行,各位有什么解决办法吗
在L4中可以在controller中定义 $layout模板,然后在请求中使用
$this->layout->content = View::make(sth view)
今天在L5.3中使用不行,各位有什么解决办法吗
真的很抱歉,我从来没有使用过L4
Laravel 5 中 Controller
是一个空白的类,里面没有任何的变量,包括layout
个人建议重新阅读手册查看view的使用方法:https://laravel-china.org/doc...(中文)
5 中很多做了升级和变革,要重新学习。
如果在 Laravel 5
尝试以下方式使用看看,就是把字段变成方法
// 在 controller 中设置原本4中设置的 $layout 视图值
public $layout_path = 'view_path';
// 提供一个方法获取 layout 视图
public function layout()
{
return view($this->layout_path);
}
// 使用( 将原本的$this->layout 改成 $this->layout() )
$this->layout()->content = View::make(sth view);
Copyright 2014-2023 //m.sbmmt.com/ All Rights Reserved | 苏州跃动光标网络科技有限公司 | 苏ICP备2020058653号-1
| 本站CDN由 数掘科技 提供