php网站地图生成类示例_PHP
程序员文章站
2024-02-11 08:52:28
...
复制代码 代码如下:
// include class
include 'SitemapGenerator.php';
// create object
$sitemap = new SitemapGenerator("http://www.bitsCN.com");
// add urls
$sitemap->addUrl("http://your.bitsCN.com", date('c'), 'daily', '1');
$sitemap->addUrl("http://your.bitsCN.com", date('c'), 'daily', '0.5');
$sitemap->addUrl("http://your.bitsCN.com", 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();
// include class
include 'SitemapGenerator.php';
// create object
$sitemap = new SitemapGenerator("http://www.bitsCN.com");
// add urls
$sitemap->addUrl("http://your.bitsCN.com", date('c'), 'daily', '1');
$sitemap->addUrl("http://your.bitsCN.com", date('c'), 'daily', '0.5');
$sitemap->addUrl("http://your.bitsCN.com", 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();
上一篇: nginx-备注
下一篇: static变量与方法