【发布时间】: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 服务器?正在运行!
-
不要直接打开您的视图。你必须从你的控制器中打开你的视图。