Zend_Feed“缺少描述密钥”

时间:2009-06-23 19:18:24

标签: zend-framework zend-feed

    //CODE
    $entries = $model->fetchEntries();

    $feedUri = '/rss/';
    //link from which feed is available
    $link = 'http://' . $_SERVER['HTTP_HOST'] . $feedUri;


    $feedArray = array(
            'title' => 'Student\'s Movie Club - Upcoming Movies',
            'link' => $link,
            'description' => 'Upcoming Movies',
            'language' => 'en-us',
            'charset' => 'utf-8',
            'pubDate' => $entries[0]['created'],
            'generator' => 'Zend Framework Zend_Feed',
            'entries' => array()
        );

    foreach ($entries as $movie) {
        $feedArray['entries'][] = array(
            'title' => $movie['movie_title'],
            'link' => '/movie/view/id/'.$movie['id'],
            'description' => $move['movie_review'],
            'pubDate' => $movie['created'],
            'guid' => 'http://' . $_SERVER['HTTP_HOST'] .'/movie/view/id/'.$movie['id']
             );
        }

    //var_dump($feedArray);
    //die();
    $feed = Zend_Feed::importArray($feedArray, 'rss');
    $feed->send();
    //~CODE

此消息引发异常:

An error occurred
Application error
Exception information:

Message: description key is missing

Stack trace:

#0 C:\wwwroot\projects\studyhood\project2\library\Zend\Feed\Builder.php(182): Zend_Feed_Builder->_createEntries(Array)
#1 C:\wwwroot\projects\studyhood\project2\library\Zend\Feed.php(385): 

任何帮助表示赞赏...

1 个答案:

答案 0 :(得分:2)

我相信这是你的问题:

'description' => $move['movie_review'],

查看$ movie的拼写:)将您的代码更改为:

foreach ($entries as $movie) {
        $feedArray['entries'][] = array(
            'title' => $movie['movie_title'],
            'link' => '/movie/view/id/'.$movie['id'],
            'description' => $movie['movie_review'],
            'pubDate' => $movie['created'],
            'guid' => 'http://' . $_SERVER['HTTP_HOST'] .'/movie/view/id/'.$movie['id']
             );
}