欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  php教程

Zend Framework Feed

程序员文章站 2022-04-30 23:37:19
...
跳至
rssreaderAction($allnewsUrl);
        $guideList = $this->rssreaderAction($guideUrl);
        $tList = $this->rssreaderAction($tUrl);
        $newcarList = $this->rssreaderAction($newcarUrl);
        $eList = $this->rssreaderAction($eUrl);
        $salesList = $this->rssreaderAction($salesUrl);
        $recallsList = $this->rssreaderAction($recallsUrl);
        $servicingList = $this->rssreaderAction($servicingUrl);
        $insuranceList = $this->rssreaderAction($insuranceUrl);
        $ultratuneList = $this->rssreaderAction($ultratuneUrl);
        $automotiveList = $this->rssreaderAction($automotiveUrl);
        $trafficList = $this->rssreaderAction($trafficUrl);
        $tireList = $this->rssreaderAction($tireUrl);
        $this->view->allnewsList = $allnewsList;
        $this->view->guideList = $guideList;
        $this->view->tList = $tList;
        $this->view->newcarList = $newcarList;
        $this->view->eList = $eList;
        $this->view->salesList = $salesList;
        $this->view->recallsList = $recallsList;
        $this->view->servicingList = $servicingList;
        $this->view->insuranceList = $insuranceList;
        $this->view->ultratuneList = $ultratuneList;
        $this->view->automotiveList = $automotiveList;
        $this->view->trafficList = $trafficList;
        $this->view->tireList = $tireList;
    }

    public function rssreaderAction($uri) {
        $rssArray = array();
        try {
            
            $rssreader = Zend_Feed::import($uri);
        } catch (Zend_Feed_Exception $e) {
            echo "导入Feed异常:$e->getMessage()\n";
            exit();
        }
        foreach ($rssreader->items as $item) {
            $rssArray[] = array(
            'title' => $item->title(),
            'link' => $item->link(),
            'description' => $item->description(),
        );
        }
        return $rssArray;
    }
    
}