如何使用 Zend Feed 获取 Feed 日期?
我正在解析 RSS 提要。一切正常,除了我不知道如何获取提要日期。
foreach ($sql as $row) { try { $feed = Zend_Feed::import($row['url']); } catch (Zend_Feed_Exception $e) { continue; } foreach ($feed as $item) { $title = $item->title(); $link = $item->link(); $show = 'yes'; $date = $feed->pubDate(); $year = date('Y', $date); $month = date('n', $date); sqlquery("INSERT INTO rw_feed ( feed_title, feed_link, feed_show, feed_date, feed_date_year, feed_date_month ) VALUES ( ?, ?, ?, ?, ?, ? )", "sssiis", array(&$title, &$link, &$show, &$date, &$year, &$month)); } }
pubDate()
不起作用。有谁知道获取日期的函数名称是什么?
I'm parsing RSS feed. Everything works fine except I don't know how to get the feed date.
foreach ($sql as $row) { try { $feed = Zend_Feed::import($row['url']); } catch (Zend_Feed_Exception $e) { continue; } foreach ($feed as $item) { $title = $item->title(); $link = $item->link(); $show = 'yes'; $date = $feed->pubDate(); $year = date('Y', $date); $month = date('n', $date); sqlquery("INSERT INTO rw_feed ( feed_title, feed_link, feed_show, feed_date, feed_date_year, feed_date_month ) VALUES ( ?, ?, ?, ?, ?, ? )", "sssiis", array(&$title, &$link, &$show, &$date, &$year, &$month)); } }
pubDate()
is not working. Does anyone know what the function is named to get the date?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
pubDate()
是正确的函数,但在您的代码中您使用了错误的变量。你必须更改为
pubDate()
is the right function, but in your code you use the wrong variable. You have to changeto