php网站地图生成类示例
程序员文章站
2023-12-10 13:11:04
复制代码 代码如下:// include classinclude 'sitemapgenerator.php';// create object$sitemap = ne...
复制代码 代码如下:
// include class
include 'sitemapgenerator.php';
// create object
$sitemap = new sitemapgenerator("//www.jb51.net");
// add urls
$sitemap->addurl("http://your.jb51.net", date('c'), 'daily', '1');
$sitemap->addurl("http://your.jb51.net", date('c'), 'daily', '0.5');
$sitemap->addurl("http://your.jb51.net", date('c'), 'daily');
// create sitemap
$sitemap->createsitemap();
// write sitemap as file
$sitemap->writesitemap();
// update robots.txt file
$sitemap->updaterobots();
// submit sitemaps to search engines
$sitemap->submitsitemap();