在 laravel 项目中生成动态站点地图而不使用作曲家
问题描述
我想为我的 laravel 项目生成 Dynamic sitemap
.我已经在很多网站上搜索过答案.他们中的一些人使用作曲家来描述它.我不知道该怎么做.在其他一些站点中,他们编写代码以循环从 db 获取 url.在我的项目数据库中,我没有保存任何网址.我的项目是一个医生和病人的网站.那么有没有人知道如何编写 php/laravel 代码来生成动态站点地图
.?
I want to generate Dynamic sitemap
for my laravel project. I had already searched in so many sites for an answer. some of them describes it using composer. I didn't get how to do that. and in some other sites they wrote codes to get urls from db in loops. In my project db I didn't saved any urls. my project is a site for doctor and patients.
so is there any one knows how to write php / laravel codes for dynamic sitemap generation
.?
编辑
我是 laravel 的新手,所以我对这个作曲家不熟悉.谁能告诉我,如果我从 github 下载 laravel-sitemap-master.zip,我可以在其中提取它并保存在我的项目目录中吗?如果有人请回答这个问题,那将非常有帮助.
I'm a newbie to laravel so i'm just unfamiliar with this composer. can anyone please tell me if i download the laravel-sitemap-master.zip from github where i can extract it and saves in my project directory? it will be so much helpful if anyone please answer this.
推荐答案
将此行添加到您的 routes.php
创建新文件appHttpMiddlewaresitemap.php
并创建新的视图文件resourcesviewssitemap.blade.php
在文件 appHttpKernel.php 中向受保护的 $middleware 数组添加一个条目
Add an entry to protected $middleware array in the file appHttpKernel.php
这篇关于在 laravel 项目中生成动态站点地图而不使用作曲家的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!