znanylekarz / ical
此包最新版本(1.0.0)没有可用的许可信息。
此包提供PHP类以创建兼容iCal的*.ics文件。
1.0.0
2012-10-24 15:04 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2024-09-14 13:18:19 UTC
README
此包提供PHP类以创建兼容iCal的*.ics文件。
使用方法
1. 创建日历对象
$vCalendar = new \Eluceo\iCal\Component\Calendar('www.example.com');
2. 创建事件对象
$vEvent = new \Eluceo\iCal\Component\Event();
3. 将信息添加到事件中
$vEvent->setDtStart(new \DateTime('2012-12-24')); $vEvent->setDtEnd(new \DateTime('2012-12-24')); $vEvent->setNoTime(true); $vEvent->setSummary('Christmas');
4. 将事件添加到日历中
$vCalendar->addEvent($vEvent);
5. 设置HTTP头
header('Content-Type: text/calendar; charset=utf-8'); header('Content-Disposition: attachment; filename="cal.ics"');
6. 发送输出
echo $vCalendar->render();