如何在xml文件中的关闭标签之前插入多个数据?

我想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);


尚方宝剑之说
浏览 109回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP