Laravel Blade 语法 @yeild('content') 不工作
Laravel Blade Syntax @yeild('content') not working
我知道这是一个非常基本和愚蠢的问题,但我从过去 2 天开始尝试但没有弄清楚我的错误在哪里我到处搜索但仍然没有弄清楚。我是 laravel 的新手,正在学习使用 blade 语法的教程。
Web.php
Route::get('about','makeController@FunFun');
makeController.php
class makeController extends Controller
{
public function FunFun(){
$first = 'Muhammad';
$last = 'Uzair Warsi';
return view('pages.app',compact('first'));
}}
app.blade.php
@extends('pages.funview')
@section('content')
<h1>my name is : {{$first}}</h1>
@stop
funview.blade.php
<!DOCTYPE html>
<head>
</head>
<html>
<title>HTML Tutorial</title>
<body>
<h1>this is from funview page</h1>
@yeild('content')
</body>
</html>
问题是 localhost 加载了所有标题标题并打印 @yeild('content') 而不是 blade 部分的内容。
语法是:
@yield('content')
不是@yeild
有关 Blade 和语法检查的更多信息:https://laravel.com/docs/5.3/blade#template-inheritance
我知道这是一个非常基本和愚蠢的问题,但我从过去 2 天开始尝试但没有弄清楚我的错误在哪里我到处搜索但仍然没有弄清楚。我是 laravel 的新手,正在学习使用 blade 语法的教程。
Web.php
Route::get('about','makeController@FunFun');
makeController.php
class makeController extends Controller
{
public function FunFun(){
$first = 'Muhammad';
$last = 'Uzair Warsi';
return view('pages.app',compact('first'));
}}
app.blade.php
@extends('pages.funview')
@section('content')
<h1>my name is : {{$first}}</h1>
@stop
funview.blade.php
<!DOCTYPE html>
<head>
</head>
<html>
<title>HTML Tutorial</title>
<body>
<h1>this is from funview page</h1>
@yeild('content')
</body>
</html>
问题是 localhost 加载了所有标题标题并打印 @yeild('content') 而不是 blade 部分的内容。
语法是:
@yield('content')
不是@yeild
有关 Blade 和语法检查的更多信息:https://laravel.com/docs/5.3/blade#template-inheritance