Website maps are vital to a website. It is a better way to create a website map and submit it to a search engine. In this way, you can not be limited by the number of pages, and you can fully control the structure information of the website map. Here we will introduce a small class that can easily generate a website map.
The Code is as follows:
// Include class
Include 'sitemapgenerator. php ';
// Create object
$ Sitemap = new SitemapGenerator ("http://www.php.net ");
// Add urls
$ Sitemap-> addUrl ("http://your.php.net", date ('C'), 'daily ', '1 ');
$ Sitemap-> addUrl ("http://your.php.net", date ('C'), 'daily ', '0. 5 ');
$ Sitemap-> addUrl ("http://your.php.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 ();