【问题标题】:Laravel won't use bladesLaravel 不会使用刀片
【发布时间】:2017-03-15 03:24:47
【问题描述】:

我正在尝试在 laravel 中创建刀片配置文件。我在“xampp\htdocs\laravel5-learning\resources\views\layouts”中创建了“master.blade.php”,其中包含:

<!DOCTYPE html>
<html>
<head>
<title>@yield('title')</title>
</head>
<body>
<div class="container">
@yield('content')
</div>
</body>
</html>

然后我在“xampp\htdocs\laravel5-learning\resources\views”方向有一个文件“welcome.blade.php”。它包含:

@extends('layouts.master')

@section('title')
Welcome!
@endsection

@section('content')
This is the content!
@endsection

但是这行不通。我那里还有一个测试 php 文件,这在运行 localhost\laravel5-learning\resources\views\test.php

时有效

我有 apache 和一个使用 xampp 运行的 sql 服务器。

有人有想法吗?我觉得我错过了使用 Laravel 的重要一步。我安装了 xampp,然后在 htdocs 文件夹中使用 composer 安装了 Laravel: 作曲家创建项目 laravel/laravel laravel5-learning

如果我转到http://localhost/laravel5-learning/resources/views/welcome.blade.php,实际代码显示: @extends('layouts.master') @section('title') 欢迎! @endsection @section('content') 这是内容! @endsection

有人有想法吗?

【问题讨论】:

  • 请检查,您的服务器是否已经运行?
  • xampp 中的 apache 服务器?正在运行!
  • 不要直接打开您的视图。你必须从你的控制器中打开你的视图。

标签: php laravel xampp blade


【解决方案1】:

找到了解决办法。我正在运行实际代码,但我应该运行 public 文件夹中的 index.html 文件。

我猜我是一个很大的菜鸟错误。

【讨论】:

    猜你喜欢
    • 2019-01-31
    • 2021-07-17
    • 2019-09-20
    • 1970-01-01
    • 2014-08-05
    • 2019-01-12
    • 2016-02-27
    • 2016-04-02
    • 1970-01-01
    相关资源
    最近更新 更多