Home > Backend Development > PHP Tutorial > php网站地图生成类示例_PHP

php网站地图生成类示例_PHP

WBOY
Release: 2016-06-01 11:57:31
Original
1012 people have browsed it

复制代码 代码如下:
// 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();

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template