0
這個問題似乎是由於Zend_Feed總是將發佈日期更改爲今天的日期/時間。PHP strtotime不能與Zend_Feed一起顯示今天的日期
foreach($array['rss']['rows'] as $row) {
try {
$pubDate = strtotime($row['from']['value']);
$entry = array(
'title' => "{$row['title']['value']}",
'pubDate' => "{$pubDate}",
'link' => "{$url}news/item/{$row['uri']['value']}",
'description' => "{$row['content']['fvalue']}"
);
array_push($this->entries, $entry);
} catch(Exception $e) {
throw($e);
}
}
$rss = array(
'title' => 'News',
'link' => $url,
'description' => 'Latest News Articles',
'charset' => 'ISO-8859-1',
'entries' => $this->entries
);
$feed = Zend_Feed::importArray($rss, 'rss');
$feed->send();
該值的格式如下2012-05-07 00:00:00
。當我var_dump
的$rss
陣列之前它被傳遞到的Zend_Feed我得到:
array(4) {
["title"]=> string(44) "International Horse Trials"
["link"]=> string(31) "http://www.horse.co.uk/"
["description"]=> string(78) "Location: Wetherby "
["pubDate"]=> string(10) "1339023600"
}
我想盡組合,我能想到的,以獲得不同的格式工作的日期。
$pubDate = gmdate(DATE_RFC822, strtotime($row['from']['value']));
爲什麼捕捉異常,只有一次扔一次? – Cobby 2012-02-05 09:04:19