简体   繁体   English

@yield和@section在laravel中不起作用

[英]@yield and @section is not working in laravel

Hello every body I am trying to use @yield and @section in my project, but it is not working. 您好我尝试在我的项目中使用@yield和@section的每个机构,但无法正常工作。 I am going to show you my code given please help me. 我将向您展示我的代码,请帮助我。 I have two views. 我有两种看法。 first one is design.blade.php containing the code 第一个是包含代码的design.blade.php

@extends('contact')

@section('content')
Hello This is Design called in contact page

@endsection

and the second one is contact.blade.php containing the code 第二个是包含代码的contact.blade.php

   <!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
<h1 align="center">@yield('content')</h1>
</body>
</html>

Please help me why it is not calling while I am trying to call contact page in browser. 当我尝试在浏览器中调用联系页面时,请帮助我为什么它没有调用。 It shows an empty or black page. 它显示空白页或黑页。

在控制器动作中,您应该返回

return view("design");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM