sitemap

php生成站点地图sitemap

$data=[ ['loc'=>'https://www.cuiwei.net/', 'lastmod'=>'2009-01-01'],//首页 ]; $xml=createXML($data); file_put_contents('sitemap.xml', $xml); function createXML($data){ $string = <<<XML XML; $xml = simplexml_load_string($string); foreach ($data as $item) { $url = $xml->addChild('url'); i...