Zend_Feed “描述密钥丢失”

发布于 2024-07-25 11:26:52 字数 1510 浏览 7 评论 0原文

    //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): 

任何帮助表示赞赏...

    //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

There is an exception thrown with this message:

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): 

Any help appreciated...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

白龙吟 2024-08-01 11:26:52

我相信这是你的问题:

'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']
             );
}

I believe this is your problem:

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

Look at the speling of $movie :) Change your code to this:

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']
             );
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文