【发布时间】:2015-05-14 09:08:10
【问题描述】:
我正在尝试从我创建的日历中创建一个 ical,两者都使用 PHP。
电话地址:https://www.gamingonlinux.com/index.php?module=calendar&view=ical
我使用了一个验证器,它声称它是有效的,但是当我将它添加到测试中时,谷歌日历中没有显示任何事件。
对我的错误有什么想法吗?
这是制作ical的代码:
// the iCal date format. Note the Z on the end indicates a UTC timestamp.
define('DATE_ICAL', 'Ymd\THis\Z');
// max line length is 75 chars. New line is \\n
$output = "BEGIN:VCALENDAR\r\nMETHOD:PUBLISH\r\nVERSION:2.0\r\nPRODID:-//Gaming On Linux//Release Calendar//EN\r\n";
$db->pquery("SELECT `id`, `date`, `name`, `comment`, `link`, `best_guess` FROM `calendar` WHERE YEAR(date) = $year AND `approved` = 1 ORDER BY `date` ASC");
// loop over events
while ($item = $db->fetch())
{
if (empty($item['edit_date']))
{
$item['edit_date'] = date("Y-m-d");
}
$output .=
"BEGIN:VEVENT\r\nSUMMARY:{$item['name']}\r\nUID:{$item['id']}\r\nDTSTART:" . date(DATE_ICAL, strtotime($item['date'])) . "\r\nDTEND:" . date(DATE_ICAL, strtotime($item['date'])) . "\r\nLAST-MODIFIED:" . date(DATE_ICAL, strtotime($item['edit_date'])) . "\r\nEND:VEVENT\r\n";
}
// close calendar
$output .= "END:VCALENDAR";
echo $output;
【问题讨论】:
-
请在此处发布您的代码以供人们阅读。