【问题标题】:Zend feed_rss object returning empty titleZend feed_rss 对象返回空标题
【发布时间】:2011-11-03 14:15:21
【问题描述】:

我使用 Zend 的 Zend_Feed_Rss 对象制作了一个 RSS 阅读器。它对我来说很好(使用提要 1),但我们的测试人员发现它不会在提要 2 上返回标题(见下文)。

  1. http://www.nu.nl/feeds/rss/algemeen.rss
  2. http://rss.slashdot.org/Slashdot/slashdotScience

     <?php
    
     //...
    
     if($setUp){
         try{
             $feed = Zend_Feed::import($this->options['feed_url']);
         }catch(Exception $e){
             $setUp = false;
             $this->view->errorMsg = $this->lang['wrongRss'];
         }
     }
    
     if($setUp){
         $this->view->feed = $feed;
         $wTitle = $feed->title();
         if($this->title != $wTitle){
             $this->title = $wTitle;
         }
     }
    
     //...
    
     ?>
    

$feed->title 和 $feed->title() 都不适用于 feed 2。

Zend_Feed_Rss 对象没有任何其他方法或属性来获取标题。谁知道怎么回事?

编辑:愚蠢的我没有正确检查 rss 提要。这是一个不起作用的 rdf 提要。条目获取正常,所以唯一不起作用的是标题。如何从 rdf 提要中获取标题? Zend 的 feed 对象似乎只支持 rss 和 Atom。

【问题讨论】:

    标签: php zend-framework dom rss


    【解决方案1】:

    您应该使用适当的 get*()-Functions,例如getTitle() 而不是属性。有关更多示例或 API 文档,请参阅 manual。

    【讨论】:

      猜你喜欢
      • 2012-08-11
      • 2014-09-29
      • 2015-02-11
      • 2020-12-21
      • 2019-04-08
      • 2012-02-22
      • 2019-07-17
      • 2018-08-03
      • 2022-01-11
      相关资源
      最近更新 更多