gpt4 book ai didi

php - 基本的 Blade 模板不起作用

转载 作者:行者123 更新时间:2023-12-02 03:00:24 25 4
gpt4 key购买 nike

这是我的路线

Route::get('test', array('uses'=>'TestController@showTest'));

这是我的 Controller :

class TestCOntroller extends \BaseController {

/**
* Display a listing of the resource.
*
* @return Response
*/
public function showTest()
{
return View::make('test.Test');
}}

这是我的 View /test/Test.blade.php

          @section('content')
<h1>HTML Ipsum Presents</h1>
@stop

当我尝试访问该网址时,它什么也没显示。我该怎么办?

最佳答案

@section('content') 定义了一个您从不显示的内容 block ,您基本上是在设置一个变量并且从不将其打印到屏幕上。

制作另一个名为布局或其他名称的模板并将其放入其中。

<!DOCTYPE html>
<html>
<head>
<title>hooray!</title>
</head>
<body>
@yield('content')
</body>
</html>

并将 @extends('layout') 放在当前模板的顶部。

然后您的内容应该会显示。

关于php - 基本的 Blade 模板不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26065167/

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