我对这个包有一个问题:https://github.com/spatie/laravel-sitemap。
我有一个代码:
$sitemap_basic = Sitemap::create()
->add(
Url::create(env('APP_URL') . '/')
->setLastModificationDate('')
->setChangeFrequency('')
->setPriority('')
);当我保存带有空参数的站点地图时,我得到了错误:
Expected type 'DateTime'. Found 'string'
Expected type 'DateTime'. Found 'string'setChangeFrequency我可以在网站地图中设置为空。但是setPriority,setLastModificationDate -不是。如何将此参数设置为空?
发布于 2019-04-01 02:34:49
$sitemap_basic = Sitemap::create()->add(Url::create(env('APP_URL') . '/'));提示setLastModificationDate方法has一个不为空的DateTime参数。
提示setPriority方法has一个不为空的float参数。
如果您不想设置这些值,请不要调用这些setter。
另外,根据我在文档和源代码中看到的内容,setChangeFrequency应该使用一些特定的字符串as you can see here来调用。
https://stackoverflow.com/questions/55443873
复制相似问题