当前位置:Gxlcms > PHP教程 > php网站地图生成类示例_PHP教程

php网站地图生成类示例_PHP教程

时间:2021-07-01 10:21:17 帮助过:22人阅读

代码如下:
// include class
include 'SitemapGenerator.php';

// create object
$sitemap = new SitemapGenerator("http://www.gxlcms.com");

// 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();

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/695104.htmlTechArticle 代码如下:

// include class include 'SitemapGenerator.php'; // create object $sitemap = new SitemapGenerator("http://www.gxlcms.com"); // add urls $sitemap-addUrl("ht...

人气教程排行