php laravel刀片模板未呈现

php laravel刀片模板未呈现,php,twitter-bootstrap,laravel,Php,Twitter Bootstrap,Laravel,我正在尝试使用Laravel和twitter引导设置一个基本页面。我安装了Laravel,得到了通用的“you's here”或w/e图像,因此看起来很有光泽。对于twitter引导,我在我的/public文件夹中添加了/resources/js、/resources/css和/resources/img下的twitter引导文件 因此,现在我正在尝试为我的视图制作一个模板,其中基本上twitter bootstrap.css文件在我的head标记中输出,bootstrap.min.js和jqu

我正在尝试使用Laravel和twitter引导设置一个基本页面。我安装了Laravel,得到了通用的“you's here”或w/e图像,因此看起来很有光泽。对于twitter引导,我在我的/public文件夹中添加了/resources/js、/resources/css和/resources/img下的twitter引导文件

因此,现在我正在尝试为我的视图制作一个模板,其中基本上twitter bootstrap.css文件在我的head标记中输出,bootstrap.min.js和jquery.js脚本include在我的closing body标记之前输出

这就是我的设置:

laravel/app/routes.php

Route::get('/', function()
{
        return View::make('hello');
});
@extends('layouts.master')

@section('content')
    <p>This is my body content.</p>
@stop
<html>
  <head>
    @section('head')
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <link href="/resources/css/bootstrap.min.css" rel="stylesheet" media="screen">
    @show
  </head>
  <body>
    <div class="container">
      @yield('content')
    </div>

  @section('footer_scripts')
    <script src="http://code.jquery.com/jquery.js"></script>
    <script src="/resources/js/bootstrap.min.js"></script>
  @show
  </body>
</html>
laravel/app/views/hello.php

Route::get('/', function()
{
        return View::make('hello');
});
@extends('layouts.master')

@section('content')
    <p>This is my body content.</p>
@stop
<html>
  <head>
    @section('head')
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <link href="/resources/css/bootstrap.min.css" rel="stylesheet" media="screen">
    @show
  </head>
  <body>
    <div class="container">
      @yield('content')
    </div>

  @section('footer_scripts')
    <script src="http://code.jquery.com/jquery.js"></script>
    <script src="/resources/js/bootstrap.min.js"></script>
  @show
  </body>
</html>

这就是它在页面和视图源中的外观。没有html标签或脚本包括;没有什么。我肯定错过了一些基本的东西,我试着翻阅了Laravel的文档,但我似乎不知道我做错了什么。。有人能给我指出正确的方向吗?

要使用刀片模板,您必须在文件名中包含
.blade
,例如,在您的情况下,它应该是

hello.blade.php
否则,它将无法渲染。阅读更多关于。 下面是我的一个测试项目(index.blade.php)中的一个示例,因为您有一个打字错误
@extends('layout.master')
,应该是这样的

@extends('layouts.master')

@section('content')
This is a sample of laravel 4 using blade template engine.
This is home page using HomeController and home.blade template.
@stop

在你的
laravel/app/views/hello.php上

该文件应该是
hello.blade.php
,因为您希望使用刀片模板引擎。。就这样

有关模板的更多信息,请访问

另外,在声明脚本的部分:

<script src="/resources/js/bootstrap.min.js"></script>

我只是想让你知道

刚刚遇到了与最初描述的相同的问题。但是:所有模板文件名都与*.blade.php所需的规范相匹配。“布局”路径名也设置正确。结果仍然没有刀片渲染,输出仅限于
@extends('layouts.master')

解决方案是:我使用了一个复制粘贴视图脚本,第一行带有
注释。从模板中删除此注释并将
@extends('layouts.master')
放在我的视图脚本的第一行,这样做了

问候,
McPan将@extends()放在第一行。

Hi也有同样的问题,我仔细检查了我的代码,结果发现我的变量漏掉了$,页面空白无法呈现,但这是lumen,希望你也能仔细检查你的代码。

我也面临同样的问题,然后我发现,在@extends('layouts.master')或任何注释之前留下空格或行将不会呈现@extends('layouts.master')应该放在最上面。

我遇到了同样的问题,解决方案是
@extends('layouts.master')
必须放在第一行。

对我来说,这是由于括号之间的空格:而不是{$name}
我使用了{{$name},它对我很有效。

AHA。事实上我确实试过了,但它仍然在做。我想问题还在于,当时我也输入了
@extends('layouts.master')
put
layout
而不是
layouts
@mysql\u noobie\u xxxx,是的,应该是
layouts
。嘿,谢谢你给我关于脚本include的提示;这对我来说是全新的,所以我有很多东西要学!谢赫回答眼前问题的速度稍微快了一点,所以我给了他答案,但也给了你+1:)如果你对你的意图进行解释,这对OP和其他访客会更有帮助。谢谢