php - Laravel:如何显示配置?

标签 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.

标题(它扩展的 View ):

<!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

前端.页脚:

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

最佳答案

确保文件名有.blade部分:

resources/views/frontend/footer.blade.php

关于php - Laravel:如何显示配置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43056036/

相关文章:

javascript - 将值添加到 2 个下拉菜单 - 问题

javascript - HTML5 - 一起开始音频和视频?

php - 将 like 语句与 $wpdb->prepare 一起使用,显示通配符所在的散列

javascript - 使用 CSS 或 javascript 仅在打印页面而不是浏览器页面中显示内容

html - 页面 anchor 在固定导航栏下

html - 具有全宽页脚的固定宽度布局

javascript - 根据输入文本更改按钮的 url

php - 为什么带有 request->only() 的 if 语句不起作用? (Laravel)

php - YouTube数据API listChannels请求有时不会为具有多个 channel 的用户返回 channel 数据

javascript - Json 语法有效,但 HighChart 无法正确显示系列