Home  >  Article  >  php教程  >  Zend Framework Feed

Zend Framework Feed

PHP中文网
PHP中文网Original
2016-05-25 17:13:111008browse

跳至

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;
    }
    
}


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn