PHP代码生成RSS 文档

80酷酷网    80kuku.com

  >

以下为引用的内容: <?php
  //for PHP 4.x/5.x/6.x
  header("Content-Type:text/xml; charset=gb2312");
  echo "<?xml version=\"1.0\" encoding=\"gb2312\"?>\n";
  echo "<rss version=\"2.0\">\n";
  echo "<channel>\n";
  echo "<title><![CDATA[“十万个为什么”电脑学习网-办公自动化频道]]></title>\n";
  echo "<description><![CDATA[http://why100000.com]]></description>\n";
  echo "<link>http://why100000.com/&lt;/link>\n";
  echo "<language>zh-cn</language>\n";
  echo "<docs>WHY100000.COM Document Center</docs>\n";
  echo "<generator>Rss Generator ByWWW.WHY100000.COM</generator>\n";
  $title = "PPS 有图像没声音的四个解决方法";
  $link = "http://www.why100000.com/show_answer.asp?autoid=1046&Path=_oa";
  $description = "PPS 有图像没声音的四个解决方法:今天打开PPS,发现只有图像却听不到声音,其他的程序声音都是正常的,说明是PPS的问题了,那么怎么样解决这…\n";
  $author = "why100000.com";
  $pubDate = "2008-4-20 18:22:28";
  create_item($title, $link, $description, $author, $pubDate);
  echo "</channel></rss>\n";
  function create_item($title_data, $link_data, $description_data, $author_data, $pubDate_data)
  {
    echo "<item>\n";
    echo "<title><![CDATA[$title_data]]></title>\n";
    echo "<link><![CDATA[$link_data]]></link>\n";
    echo "<description><![CDATA[$description_data]]></description>\n";
    echo "<author><![CDATA[$author_data]]></author>\n";
    echo "<pubDate><![CDATA[$pubDate_data]]></pubDate>\n";
    echo "</item>\n";
  }
?>

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: