Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 拉维叶片@截面未显示_Php_Laravel_Frameworks_Blade - Fatal编程技术网

Php 拉维叶片@截面未显示

Php 拉维叶片@截面未显示,php,laravel,frameworks,blade,Php,Laravel,Frameworks,Blade,我有一个名为“home.blade.php”的刀片页面 home.blade.php <doctype html> <html> <head> <title>{{$title}}</title> </head> <body> <!-- some other html here --> @section('content') @show

我有一个名为“home.blade.php”的刀片页面

home.blade.php

<doctype html>

<html>
   <head>
      <title>{{$title}}</title>
   </head>
   <body>
      <!-- some other html here -->
      @section('content')
      @show
   </body>
</html>
@extends('home')

@section('content')
   <p>Page content goes here</p>
@endsection
控制器代码

Route::get('/', 'Controller@show')->name("home");
public function show()
{
    return view("home", ['title' => "My Home"]);
}

我错过了什么

更新:我刚刚再次检查,您应该加载
内容
视图,而不是
主页
布局

我认为您必须在
home.layout.blade中定义
@yield
而不是
@section

<html>
   <head>
      <title>{{$title}}</title>
   </head>
   <body>
      <!-- some other html here -->
      @yield('content')
   </body>
</html>


{{$title}}
@产量(‘含量’)

您可以从更新版中阅读更多内容:我刚刚再次检查,您应该加载
内容
视图,而不是
主页
布局

我认为您必须在
home.layout.blade中定义
@yield
而不是
@section

<html>
   <head>
      <title>{{$title}}</title>
   </head>
   <body>
      <!-- some other html here -->
      @yield('content')
   </body>
</html>


{{$title}}
@产量(‘含量’)

您可以从

中阅读更多内容,为什么不尝试使用@yield

@yield('content')


希望这有帮助:)

为什么不尝试使用@yield

@yield('content')


希望这有帮助:)

Opps,我刚刚又检查了一遍。我认为在控制器的
show()
操作中,您必须加载
内容
视图,而不是
主页
视图。耶!明白了@haidangyou应该叫“content”而不是home.blade.phpops,我刚刚又查过了。我认为在控制器的
show()
操作中,您必须加载
内容
视图,而不是
主页
视图。耶!明白了@haidangyou应该调用'content'而不是home.blade.phpIt是因为内容在content.blade.php文件中而不是home.blade.php,尝试加载content.blade.php视图,您将看到文本。这是因为内容在content.blade.php文件中而不是home.blade.php中,尝试加载content.blade.php视图,您将看到文本