这里我使用的是sitemap
$sitemap = Sitemap::create()->add(Url::create('/content'));
$sitemap->writeToFile(public_path($this->path));这是sitemap.xml
<url>
<loc>http://api-core.test/content</loc>
<lastmod>2020-09-09T11:30:51+04:30</lastmod>
<changefreq>daily</changefreq>
<priority>0.8</priority>
</url>有没有办法在不更改环境的情况下更改api-core.test
发布于 2021-01-12 17:10:42
如果Url::create('http://example.com/content')中的字符串包含http create函数没有将url粘贴到字符串的开头,我找到了一种更改baseurl的方法。
站点地图将更改为
<url>
<loc>http://example.com/content</loc>
<lastmod>2020-09-09T11:30:51+04:30</lastmod>
<changefreq>daily</changefreq>
<priority>0.8</priority>
</url>即使APP_URL是别的东西
https://stackoverflow.com/questions/65666346
复制相似问题