• PHP生成RSS报


    <?php
    $sql="select * from wx_zimi ";
    $res=$dbs->query($sql);
    $arr=array();
    while($o=$dbs->fetch_object($res)){
        $arr[]=$o;
    }
    //print_r($arr);die;
    $now = date("D, d M Y H:i:s T");

    $output = "<?xml version="1.0"?>
                <rss version="2.0">
                    <channel>
                        <title>Our Demo RSS</title>
                        <link>http://www.tracypeterson.com/RSS/RSS.php</link>
                        <description>A Test RSS</description>
                        <language>en-us</language>
                        <pubDate>$now</pubDate>
                        <lastBuildDate>$now</lastBuildDate>
                        <docs>http://someurl.com</docs>
                        <managingEditor>you@youremail.com</managingEditor>
                        <webMaster>you@youremail.com</webMaster>
                ";

    foreach ($arr as $line)
    {
        $output .= "<item><title>".$line->main."</title>
                        <link>".$line->jieguo."</link>
                        
    <description>".$line->id."</description>
                    </item>";
    }
    $output .= "</channel></rss>";
    echo $output;
    ?>

    转载自:https://www.ibm.com/developerworks/cn/xml/x-phprss/

  • 相关阅读:
    微信小程序之授权 wx.authorize
    微信小程序之可滚动视图容器组件 scroll-view
    纯 CSS 利用 label + input 实现选项卡
    Nuxt.js + koa2 入门
    koa2 入门(1)koa-generator 脚手架和 mongoose 使用
    vue 自定义指令
    时运赋
    WEBGL 2D游戏引擎研发系列 第一章 <新的开始>
    EasyUI特殊情况下的BUG整理
    数字时钟DigClock
  • 原文地址:https://www.cnblogs.com/myphper/p/3228058.html
Copyright © 2020-2023  润新知