Laravel 的 Blade 无法正常工作
Laravel's Blade not working correctly
我刚刚用 Homestead 开始了一个新的 Laravel 5.3 项目,我正在尝试为我的站点设置一个非常简单的结构,但是我 运行意外问题。
- resources
-- views
--- layouts
------- master.blade.php
--- partials
------- home.blade.php
------- about.blade.php
-- index.blade.php
master.blade.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>@yield('title')</title>
<!-- Bootstrap -->
<link href="{{URL::asset('css/app.css')}}" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
@yield('content')
<script src="{{URL::asset('js/app.js')}}"></script>
</body>
</html>
由于某些原因,<head>
标签之间的内容被输出到 <body>
标签中。
index.blade.php - 扩展 master
@extends('layouts.master')
@include('partials.nav')
@section('content')
<p>yes</p>
@endsection
我该如何解决这个问题?
@include('partials.nav') 应该在 master.blade.php 中。扩展模板时,Laravel 有线策略在未生成模板时放置包含的模板。
我刚刚用 Homestead 开始了一个新的 Laravel 5.3 项目,我正在尝试为我的站点设置一个非常简单的结构,但是我 运行意外问题。
- resources
-- views
--- layouts
------- master.blade.php
--- partials
------- home.blade.php
------- about.blade.php
-- index.blade.php
master.blade.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>@yield('title')</title>
<!-- Bootstrap -->
<link href="{{URL::asset('css/app.css')}}" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
@yield('content')
<script src="{{URL::asset('js/app.js')}}"></script>
</body>
</html>
由于某些原因,<head>
标签之间的内容被输出到 <body>
标签中。
index.blade.php - 扩展 master
@extends('layouts.master')
@include('partials.nav')
@section('content')
<p>yes</p>
@endsection
我该如何解决这个问题?
@include('partials.nav') 应该在 master.blade.php 中。扩展模板时,Laravel 有线策略在未生成模板时放置包含的模板。