gpt4 book ai didi

laravel - 顶部带有注释的 Blade 模板不起作用

转载 作者:行者123 更新时间:2023-12-02 16:50:58 26 4
gpt4 key购买 nike

文件:app/route.php

Route::get('/', function()
{
return View::make('home');
});

文件:app/views/home.blade.php

{{-- Blade comment. --}}
@extends('layouts.base')

@section('head')
<link rel="stylesheet" href="second.css" />
@stop

@section('body')
<h1>Heading</h1>
<p>Hello Home!</p>
@stop

文件:app/views/layouts/base.blade.php

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
@section('head')
<link rel="stylesheet" href="style.css" />
@show
</head>
<body>
@yield('body')
</body>
</html>

当我访问 laravel.localhost/时它只输出@extends('layouts.base')

但是,如果我删除

{{-- Blade comment. --}}

然后就可以完美运行了。

我可以知道是什么问题吗?

最佳答案

扩展 Blade View 中的第一行必须是 @extends 指令。

关于laravel - 顶部带有注释的 Blade 模板不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17019982/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com