我想sitemap.xml通过 PHP生成DOMDocument
现在我有三个数组:
$category[] = array(
'loc' => 'http://example.com/?=10',
'lastmod' => '2019-05-12 10:47:05',
'changefreq' => 'always',
'priority' => '1.0'
);
$board[] = array(
'loc' => 'http://example.com/?=3',
'lastmod' => '2019-05-12 10:47:05',
'changefreq' => 'always',
'priority' => '1.0'
);
$article[] = array(
'loc' => 'http://example.com/?='.$row['id'],
'lastmod' => $row['last_mod'],
'changefreq' => $row['changefreq'],
'priority' => $row['priority']
);
选项:
//Set Sitemap
$seoOption = array(
'version' => '1.0',
'charset' => 'UTF-8',
'xml_filename' => 'seo.xml'
);
$seo = new SitemapGenerator($seoOption);
$seo->generateXML($category);
$seo->generateXML($board);
$seo->generateXML($article);