PHP生成网站sitemap.xml
来源:互联网 发布:js正则表达式与java 编辑:程序博客网 时间:2024/04/20 09:36
格式参考 http://zhanzhang.baidu.com/wiki/44
function makeXML(){ $content='<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"> '; $data_array=array( array( 'loc'=>'http://www.phpernote.com/', 'priority'=>'1.0', 'lastmod'=>'2012-06-03T04:20:32-08:00', 'changefreq'=>'always', ), array( 'loc'=>'http://www.phpernote.com/php/', 'priority'=>'0.5', 'lastmod'=>'2012-06-03T04:20:32-08:00', 'changefreq'=>'daily', ) ); foreach($data_array as $data){ $content.=$this->create_item($data); } $content.='</urlset>'; $fp=fopen('sitemap.xml','w+'); fwrite($fp,$content); fclose($fp); }function create_item($data){ $item="<url>\n"; $item.="<loc>".$data['loc']."</loc>\n"; $item.="<priority>".$data['priority']."</priority>\n"; $item.="<lastmod>".$data['lastmod']."</lastmod>\n"; $item.="<changefreq>".$data['changefreq']."</changefreq>\n"; $item.="</url>\n"; return $item; }
阅读全文
0 0
- PHP生成网站sitemap.xml
- Django生成网站的sitemap.xml
- .net 生成网站地图 sitemap.xml
- C# 网站sitemap.xml生成工具
- sitemap.xml生成方法(asp和php)
- 网站地图Sitemap.xml笔记
- java 定时器生成sitemap.xml
- 如何制作网站地图(sitemap.html和sitemap.xml)?
- 提升网站建设效果之自动生成站点地图sitemap.xml
- 如何让帝国CMS如何自动生成sitemap.xml网站地图文件
- 米扑科技的开源项目:sitemap-php 自动生成网站地图
- 创建Google网站地图Sitemap.xml
- ecshop生成静态网站地图sitemap.html
- Dedecms生成sitemap.xml的简单方法
- sitemap.xml
- 网站XML格式的网站地图(sitemap)格式
- 批量提取 sitemap.xml 中的链接生成 sitemap.txt (Python脚本)
- phpcms v9网站如何生成地图sitemap静态页面
- IOS CoreText --- 支持图片及链接的点击
- Java环境配置 Windows10
- 关于ipv6相关审批不过的问题解决。
- Eclipse用户自定义类库
- 项目添加CocoaPod
- PHP生成网站sitemap.xml
- 4. Median of Two Sorted Arrays
- UVa11426
- SpringMVC:Write operations are not allowed in read-only mode (FlushMode.MANUAL)异常
- 使用jmeter进行App服务器压力测试
- android studio Module跳转配置
- Java面试题全集(上)
- Spring Boot Shiro视频实战篇
- 100+经典Java面试题及答案解析