【问题标题】:Laravel: how to display config?Laravel:如何显示配置?
【发布时间】:2017-03-27 20:37:52
【问题描述】:

我最近更改了我的页面以使用扩展标题,因为每个页面上的标题内容都相同,所以这似乎是个好主意。完成此操作后,我的页脚完全停止工作,以及它的配置部分。当我现在尝试从 Laravel 获取配置时,它只是显示为正常内容,您可以在下面看到:

页脚如何显示:

{{ Config::get('frontend.site_name') }} 2017 / Powered by the amazing {{ config('frontend.powered_by') }}.
Copyright © 2017 {{ Config::get('frontend.website_author') }}, and others who have supported this project. All rights reserved.

标题(它扩展的视图):

<!DOCTYPE html>
<html lang="{{ config('app.locale') }}">
<head>
    <title>{{ config('frontend.site_name') }} - @yield('title')</title>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link href="{{ config('frontend.assets_path') }}/css/override.css" rel="stylesheet" type="text/css">
</head>
<body id="home">
    <div class="container">
        <br>
        @yield('body')
    </div>
    @include('frontend.footer')
</body>
</html>

实际看法:

@extends('frontend.header')
    @section('title')
        Home
    @endsection
    @section('body')
    Write something here soon
    @endsection

前端.footer:

    <div class="container">
        <div class="col-md-12" style="margin-bottom:2%;">
            {{ Config::get('frontend.site_name') }} <?php echo date("Y"); ?> / Powered by the amazing {{ config('frontend.powered_by') }}.<br>
            Copyright © 2017 {{ Config::get('frontend.website_author') }}, and others who have supported this project. All rights reserved.
        </div>
    </div>
    <script src="https://use.fontawesome.com/905fc4df74.js"></script>
    <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</body>
</html>

【问题讨论】:

    标签: php html css laravel


    【解决方案1】:

    确保文件名有.blade部分:

    resources/views/frontend/footer.blade.php
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-03-05
      • 2020-10-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-20
      • 2012-08-28
      • 2017-10-30
      相关资源
      最近更新 更多