【问题标题】:@yield('content') on laravel not working just plain white textlaravel 上的 @yield('content') 不能仅使用纯白色文本
【发布时间】:2017-10-09 07:28:41
【问题描述】:

我已经安装了 Laravel Blade Highlighter..

@yield @section @endsection 不起作用,只是一个纯白色文本..

我的视图工作正常..我可以浏览它们没问题..

这是我的代码:

web.php:

    Route::get('/', 'PagesController@index');
Route::get('/about', 'PagesController@about');
Route::get('/services', 'PagesController@services');

pagesController.php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class PagesController extends Controller
{
    public function index(){
        return view('pages.index');;
    }

    public function about(){
        return view('pages.about');
    }

    public function services(){
        return view('pages.services');
    }

}

app.blade.php

<h1>This is the laravel</h1>
@yield('content')

index.php:

@extends('layouts.app')

@section('content')
    <h1>Welcome to Laravel</h1>
    <p>this is a content</p>
@endsection

【问题讨论】:

  • 而且 app.blade.php 在 layouts 目录中,对吧?
  • 你需要把index.php改成index.blade.php然后你需要把storage权限改成php可以写在那里。
  • 是的,谢谢!我应该关闭 sublime text 上的所有选项卡,这样我才能看到更改。

标签: laravel sublimetext3 blade highlight yield


【解决方案1】:

答案是我应该关闭所有打开的标签页。

而index.php、about.php和services.php应该是index.blade.php、about.blade.php和services.blade.php

【讨论】:

    猜你喜欢
    • 2019-05-07
    • 2015-11-07
    • 2013-09-09
    • 2012-01-28
    • 2021-01-21
    • 1970-01-01
    • 2021-12-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多