1、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();
以上缺少属性定义符 var2、      $s .= "<channel>\n";
       $s .= "<title>{$this->channel_title}</title>\n" <== 缺少行结束符3、// start items
       for ($i=0;$i<count($this->items),$i++) {
那个“,”对吗?还说测试过了,基本的语法检测都通不过更不要说结果了

解决方案 »

  1.   

    3、// start items
           for ($i=0;$i<count($this->items),$i++) {
    那个“,”对吗?呵呵,这个应该是";" 
    刚刚学习,请多多指教!
      

  2.   

    <?php if (defined('_CLASS_RSS_PHP')) return;
    define('_CLASS_RSS_PHP',1);
    /**
     *  Class name: RSS
     *  Author    : RedFox
     *  website   : http://www.foxbat.cn/  
     *  blog      : http://redsoft.yculblog.com/
     *  CopyRight : RedFox ([email protected])
     */
    class RSS {
       //public
       var $rss_ver = "2.0";
       var $channel_title = '';
       var $channel_link = '';
       var $channel_description = '';
       var $language = 'zh_CN';
       var $copyright = '';
       var $webMaster = '';
       var $pubDate = '';
       var $lastBuildDate = '';
       var $generator = 'RedFox RSS Generator';   var $content = '';
       var $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('title' => $title ,
                            'link' => $link,
                            'description' => $description, 
                            'pubDate' => $pubDate);
       }   function BuildRSS() {
           $s = "<?xml version=\"1.0\" encoding=\"gb2312\" ?>\n<rss version=\"2.0\">\n";
           // start channel
           $s .= "<channel>\n";
           $s .= "<title><![CDATA[{$this->channel_title}]]></title>\n";
           $s .= "<link><![CDATA[{$this->channel_link}]]></link>\n";
           $s .= "<description><![CDATA[{$this->channel_description}]]></description>\n";
           $s .= "<language>{$this->language}</language>\n";
           if (!empty($this->copyright)) {
              $s .= "<copyright><![CDATA[{$this->copyright}]]></copyright>\n";
           }
           if (!empty($this->webMaster)) {
              $s .= "<webMaster><![CDATA[{$this->webMaster}]]></webMaster>\n";
           }
           if (!empty($this->pubDate)) {
              $s .= "<pubDate>{$this->pubDate}</pubDate>\n";
           }       if (!empty($this->lastBuildDate)) {
              $s .= "<lastBuildDate>{$this->lastBuildDate}</lastBuildDate>\n";
           }       if (!empty($this->generator)) {
              $s .= "<generator>{$this->generator}</generator>\n";
           }
           
           // start items
           for ($i=0;$i<count($this->items);$i++) {
               $s .= "<item>\n";
               $s .= "<title><![CDATA[{$this->items[$i]['title']}]]></title>\n";
               $s .= "<link><![CDATA[{$this->items[$i]['link']}]]></link>\n";
               $s .= "<description><![CDATA[{$this->items[$i]['description']}]]></description>\n";
               $s .= "<pubDate>{$this->items[$i]['pubDate']}</pubDate>\n";           
               $s .= "</item>\n";
           }
          
          // close channel
          $s .= "</channel>\n</rss>";
          $this->content = $s;
       }   function Show() {
           if (empty($this->content)) $this->BuildRSS();
           echo($this->content);
       }   function SaveToFile($fname) {
           $handle = fopen($fname, 'wb');
           if ($handle === false)  return false;
           fwrite($handle, $this->content);
           fclose($handle);
       }
    }?>
    重新修改了一些细节