復制代碼 代碼如下:
// include class
include 'SitemapGenerator.php';
// create object
$sitemap = new SitemapGenerator("http://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();