PHP生成RSS文件类实例_

上传人:一** 文档编号:24916661 上传时间:2021-07-16 格式:DOCX 页数:5 大小:12.13KB
返回 下载 相关 举报
PHP生成RSS文件类实例__第1页
第1页 / 共5页
PHP生成RSS文件类实例__第2页
第2页 / 共5页
PHP生成RSS文件类实例__第3页
第3页 / 共5页
点击查看更多>>
资源描述
PHP生成RSS文件类实例_ PHP RSS 生成类实例代码如下: 代码如下: ?php if (defined(_class_rss_php) return; define(_class_rss_php教程,1); /* * 用法说明: * $rss = new rss(redfox, blog); * $rss-additem(rss class,(); * $rss-additem(.); * $rss-savetofile(.); */ class rss /public $rss_ver = 2.0; $channel_title = ; $channel_link = ; $channel_description = ; $language = zh_cn; $copyright = ; $webmaster = ; $pubdate = ; $lastbuilddate = ; $generator = redfox rss generator; $content = ; $items = array(); function rss($title, $link, $description) $this-channel_title = $title; $this-channel_link = $link; $this-channel_description = $description; $this-pubdate = date(y-m-d h:i:s,time(); $this-lastbuilddate = date(y-m-d h:i:s,time(); function additem($title, $link, $description ,$pubdate) $this-items = array(titile = $title , link = $link, description = $description, pubdate = $pubdate); function buildrss() $s = !-l version=1.0 encoding=gb2312- ; / start channel $s .= ; $s .= $s .= link /$this-channel_link ; $s .= $this-channel_description ; $s .= $this-language ; if (!emptyempty($this-copyright) $s .= $this-copyright ; if (!emptyempty($this-webmaster) $s .= $this-webmaster ; if (!emptyempty($this-pubdate) $s .= $this-pubdate ; if (!emptyempty($this-lastbuilddate) $s .= $this-lastbuilddate ; if (!emptyempty($this-generator) $s .= $this-generator ; / start items for ($i=0;$iitems),$i+) $s .= ; $s .= ; $s .= link /$this-items$ilink ; $s .= !-data$thi-items$idescription ; $s .= $this-items$ipubdate ; $s .= ; / close channel $s .= ; $this-content = $s; function show() if (emptyempty($this-content) $this-buildrss(); header(content-type:text/xml); echo($this-content); function savetofile($fname) if (emptyempty($this-content) $this-buildrss(); $handle = fopen($fname, wb); if ($handle = false) return false; fwrite($handle, $this-content); fclose($handle); ? 更多信息请查看IT技术专栏 .
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 工作计划


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!