Php 拉威尔4号刀片的怪异行为
所以,我有这样的代码来打印我的索引页:Php 拉威尔4号刀片的怪异行为,php,laravel,laravel-4,blade,Php,Laravel,Laravel 4,Blade,所以,我有这样的代码来打印我的索引页: class PageController extends MediaController { protected $layout = 'layouts.main'; public function index_page() { $data = array(); $data['title'] = 'Dynamic Title'; $data['css_files'] = array( array('media'=
class PageController extends MediaController {
protected $layout = 'layouts.main';
public function index_page() {
$data = array();
$data['title'] = 'Dynamic Title';
$data['css_files'] = array(
array('media'=>'all', 'file'=>'file1'),
array('media'=>'all', 'file'=>'file2')
);
$this->layout->content = View::make('index', $data);
}
}
还有我的main.blade.php:
<html>
<head>
<title>@yield('title')</title>
</head>
<body>
@yield('content')
@yield('css_files')
</body>
</html>
@section('title', $title)
@section('css_files')
@foreach ($css_files as $css_file)
<p>File: {{ $css_file->file }}, Media: {{ $css_file->media }}</p>
@endforeach
@stop
@section('content')
<h1>Rendered Successfully!</h1>
@stop
到
所以我应该用{=而不是{{
希望这对将来的人有所帮助。标题部分下面缺少@stop。请尝试这样做
@section('title')
{{ $title }}
@stop
标题部分下方缺少@stop。请尝试这样做
@section('title')
{{ $title }}
@stop
为什么您必须使用
{=/code>?通常不应修改供应商文件夹,因为如果您通过composer进行更新,您的更改将被覆盖。用于将blade与angular.js结合使用时,必须更改语法现在非常合理为什么您必须使用{=
?通常不应修改供应商文件夹,因为如果通过composer进行更新,您所做的更改将被覆盖。用于将blade与angular.js结合使用时,必须更改Syntax。现在,这非常有意义
@section('title')
{{ $title }}
@stop