在我的页面控制器中
$this->layout->content = View::make('authentication/login')->with('page_title','title');
我正在使用刀片文件作为模板。在html的头中,我有
<title>{{$page_title}}</title>
我收到$page_title
未定义的错误。
我理想地想要的是一个$data=array('page_title'=>'Login','second_item'=>'value')...
。但是由于无法将变量的基本传递传递给视图,因此我首先坚持使用该变量。
正如@Gravy指出的那样,有很多方法可以实现这一点,但是从她尝试编写代码的方式来看,解决方案是:
$data = array();
$this->layout->with('data', $data);
$this->layout->content = View::make('home');
在此处查看更多信息:http : //forums.laravel.io/viewtopic.php?pid=58548#p58548
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句