是否已经实现了从XML文件创建(HTML)站点地图的机制?
我正在使用Python script来生成站点地图,并希望以超文本标记语言列表的形式显示我的站点地图(其中的一部分)。
发布于 2013-04-14 01:31:05
轻松使用simple_xml:
$xmlFile = 'sitemap.xml';
if (!file_exists($xmlFile)) {
throw new \Exception("File does not exist");
}
$xml = simplexml_load_file($xmlFile);
echo "<ul class=\"sitemap\">";
foreach($xml as $url) {
echo "<li>" . $url->loc . "</li>";
}
echo "</ul>";https://stackoverflow.com/questions/15990562
复制相似问题