所以,我在这段小代码上遇到了很多麻烦。一个示例时间戳是这样的:'1278509422000'.. 问题是它以字符串形式出现,我必须以某种方式对其进行转换。我知道毫秒的问题,并尝试过除以 1000 甚至更多(intval/floatval),但它不会成为正确的日期时间值。
Zend_Loader::loadClass('Zend_Gdata_Photos');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
$gp = new Zend_Gdata_Photos(Zend_Gdata_AuthSub::getHttpClient($data->token), "Bla");
try {
$userFeed = $gp->getUserFeed("default");
foreach ($userFeed as $userEntry) {
$album = $userEntry->getGphotoName();
try {
$query = $gp->newAlbumQuery();
$query->setUser("default");
$query->setAlbumName($album);
$albumFeed = $gp->getAlbumFeed($query);
foreach ($albumFeed as $photo) {
$time = date('Y-m-d H:m:s', $photo->getGphotoTimestamp());
}
} catch(Exception $e) {
}
}
} catch(Exception $e) {
}