龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > web编程 > php编程 >

php生成百度sitemap站点地图类函数实例(2)

时间:2014-10-19 15:49来源:网络整理 作者:网络 点击:
分享到:
复制代码 代码如下: 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>

 
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>

 
至于sql代码主要就是一个select语句,这里就不贴出来了。

希望本文所述对大家的php程序设计有所帮助。

精彩图集

赞助商链接