我正在使用 spatie/laravel-sitemap 是否可以为这些 url 设置另一个 APP_URL

I'm using spatie/laravel-sitemap is it possible to set another APP_URL for these url

这里我使用的是站点地图

    $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

我找到了改变基数的方法url 如果 Url::create('http://example.com/content') 中的字符串包含 http 创建函数不会在字符串开头粘贴 url

站点地图将更改为

<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 是其他东西