我用谷歌搜索了这个问题,虽然有些人有同样的问题,但很明显是什么导致了他们的问题(缺少@endsection等)
然而,在我的情况下,我很遗憾为什么会发生这种情况。它不会发生在Laravel生成的页面上(make:auth pages);但是我自己做的就是它。
layout.app:
<!DOCTYPE html>
<html lang="{{ config('app.locale') }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Student Picker</title>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">
<!-- Styles -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="{{ URL::asset('css/styles.css') }}" />
</head>
<body>
<div class="content">
@if(Auth::check())
<div class="links">
<a href="/home">Profile</a>
<a href="/courses">My Courses</a>
<a href="/contact">Contact</a>
</div>
@else
<div class="links">
<a href="/">Home</a>
<a href="/about">About Us</a>
<a href="/login">Login</a>
<a href="/register">Register</a>
<a href="/contact">Contact</a>
</div>
@endif
<main>
@yield( 'content_header' )
<hr>
@yield( 'content' )
</main>
</div>
</body>
<footer>
... scripts ...
</footer>
</html>
welcome.blade.php(此<header>
代码中出现<body>
代码
@extends('layouts.app');
@section('content_header')
<div class="title m-b-md">
Student Picker
</div>
@endsection
@section('content')
<div class="content">
Welcome to the Student Picker! Feel free to explore our website, singup, or login.
</div>
@endsection
login.blade.php(这个工作正常):
@extends('layouts.app')
@section('content_header')
<div class="title m-b-md">
Login
</div>
@endsection
@section('content')
<div class="container">
<div class="row">
...
</div>
</div>
@endsection