php - 如果显示特定页面,如何包含特定文件
问题描述
我想添加 layouts/frontend.blade.php
根据页面包含不同的 seo.blade.php 文件。
@if (page == 'home')
@include('partials.seo')
@endif
@if (page == 'about')
@include('partials.seo2')
@endif
我该怎么做?
解决方案
您可以使用分段:
@if (request()->segment(0) == 'home')
@include('partials.seo')
@endif
@if (request()->segment(0) == 'about')
@include('partials.seo2')
@endif
推荐阅读
- woocommerce - 如何在与该供应商相关的每个产品中显示 Woocommerce 产品供应商的个人资料图片
- php - 如何在 PHP 中上传到 App Engine 中的存储桶?
- python - 在一个类中组合python中的不同过程
- neo4j.rb - Neo4j.rb 在同一个查询中给出两种类型的对象(随机)
- python-2.7 - 如何从 Python Scrapy 中的子 url 获取数据
- c# - 将第一行设置为列名并调整列宽
- json - HttpClient.post 成功但没有向 json 发送数据
- haskell - Haskell 中的容器类型类
- tcl - TCL 获取二级变量的值
- java - 如何将字符串存储到android中的文件