小编Slá*_*nko的帖子

Laravel中的刀片引擎 - 产量不起作用

我一直在尝试简单的刀片模板工作.这是代码:

routes.php文件

<?php

Route::get('/', function()
{
    return View::make('hello');
});
Run Code Online (Sandbox Code Playgroud)

BaseController.php

<?php

class BaseController extends Controller {

    /**
     * Setup the layout used by the controller.
     *
     * @return void
     */
    protected function setupLayout()
    {
        if ( ! is_null($this->layout))
        {
            $this->layout = View::make($this->layout);
        }
    }

}
Run Code Online (Sandbox Code Playgroud)

hello.blade.php

<!DOCTYPE html>
<html>
<head>
    <title>swag</title>
</head>
<body>

    hello

    @yield('content')

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

content.blade.php

@extends('hello')

@section('content')

<p>content check</p>

@stop
Run Code Online (Sandbox Code Playgroud)

当我在浏览器中运行此代码时,所有内容都只是我在hello.blade.php中编写的hello文本,但yield('content')没有显示任何内容,我无法弄清楚原因.我很感激任何帮助,谢谢

php laravel blade

7
推荐指数
2
解决办法
2万
查看次数

标签 统计

blade ×1

laravel ×1

php ×1