php生成百度sitemap站点地图类函数实例(2)
复制代码 代码如下: xml version="1.0" encoding="UTF-8" sitemapindex sitemap lochttp://www.xxx.cn/ask/setmapxml/0.xml/loc lastmod2014-05-12/lastmod /sitemap sitemap lochttp://www.xxx.cn/ask/setm
复制代码 代码如下:
<?xml version="1.0" encoding="UTF-8" ?>
<sitemapindex>
<sitemap>
<loc>http://www.xxx.cn/ask/setmapxml/0.xml</loc>
<lastmod>2014-05-12</lastmod>
</sitemap>
<sitemap>
<loc>http://www.xxx.cn/ask/setmapxml/1.xml</loc>
<lastmod>2014-05-12</lastmod>
</sitemap>
</sitemapindex>
<sitemapindex>
<sitemap>
<loc>http://www.xxx.cn/ask/setmapxml/0.xml</loc>
<lastmod>2014-05-12</lastmod>
</sitemap>
<sitemap>
<loc>http://www.xxx.cn/ask/setmapxml/1.xml</loc>
<lastmod>2014-05-12</lastmod>
</sitemap>
</sitemapindex>
xml文件格式(每个文件需要存储5000条、现展示1条例子)
复制代码 代码如下:
<?xml version="1.0" encoding="UTF-8" ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:mobile="http://www.baidu.com/schemas/sitemap-mobile/1/">
<url>
<loc>http://m.xxx.cn/ask/7460.html</loc>
<mobile:mobile type="mobile"/>
<lastmod>2013-01-11</lastmod>
<changefreq>daily</changefreq>
<priority>0.8</priority>
</url>
<url>
</urlset>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:mobile="http://www.baidu.com/schemas/sitemap-mobile/1/">
<url>
<loc>http://m.xxx.cn/ask/7460.html</loc>
<mobile:mobile type="mobile"/>
<lastmod>2013-01-11</lastmod>
<changefreq>daily</changefreq>
<priority>0.8</priority>
</url>
<url>
</urlset>
至于sql代码主要就是一个select语句,这里就不贴出来了。
希望本文所述对大家的php程序设计有所帮助。
精彩图集
精彩文章