@extends('layout')laravel.刀片模板系统似乎不起作用

Lui*_*yfe 10 php laravel

我尝试使用laravel的模板系统:blade但在文件中使用以下代码时似乎无法正常工作users.blade.php:

@extends('layout')

@section('content')
Users! @stop
Run Code Online (Sandbox Code Playgroud)

和浏览器,

 @extends('layout')
Run Code Online (Sandbox Code Playgroud)

iav*_*ery 7

如果您在/app/views/layout.blade.php中包含模板文件,那么这应该有用

<p>Some content here</p>

@yield('content')

<p>Some additional content here</p>
Run Code Online (Sandbox Code Playgroud)

然后在你的/app/views/user.blade.php中,内容

@extends('layout')

@section('content')

<p>This is the user content</p>

@stop
Run Code Online (Sandbox Code Playgroud)

如果你打电话,return View::make('user')你应该有编译的内容

<p>Some content here</p>

<p>This is the user content</p>

<p>Some additional content here</p>
Run Code Online (Sandbox Code Playgroud)

我希望这有助于为您澄清事情.如果没有,您能提供模板文件位置和相关内容吗?

  • 我是Laravel的新手,很可惜刀片模板很容易破坏,只是因为一个错位的空白...... (2认同)