是否已经实现了从XML文件创建(HTML)站点地图的机制?
我正在使用 Python script 生成网站地图,并希望将我的网站地图作为HTML列表进行gisplay(一部分)。
Python
使用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>";