Laravel:如何显示配置?

时间:2017-03-27 20:37:53

标签: php html css laravel

我最近更改了我的页面以使用扩展标题,因为标题内容在每个页面上都是相同的,所以这看起来是个好主意。一旦我完成了这个,我的页脚完全停止工作,以及它的配置部分。当我现在尝试从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

Frontend.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>

1 个答案:

答案 0 :(得分:1)

确保文件名包含.blade部分:

resources/views/frontend/footer.blade.php