下面是一些代码也许可以帮助:
谷歌日历:
<?php
function generate_calendar_button($name, $description, DateTime $start, DateTime $end, $location, $mysite_url, $mysite_name) {
$url = 'http://www.google.com/calendar/event?action=TEMPLATE';
$parts = array();
$parts['text'] = urlencode($name);
$parts['details'] = urlencode($description);
$parts['dates'] = urlencode($start->format("Ymd\THis\Z")) . "/" . urlencode($end->format("Ymd\THis\Z"));
$parts['location'] = urlencode($location);
$parts['sprop'] = urlencode($mysite_url);
$full_link = $url;
foreach ($parts as $key => $value) {
$full_link .= "&" . $key . "=" . $value;
}
$full_link .= "&sprop=name:" . urlencode($mysite_name);
return '<a href="' . $full_link . '" target="_blank"><img src="http://www.google.com/calendar/images/ext/gc_button1.gif" border=0></a>';
}
print generate_calendar_button(
"Boulevard Summer Show",
"Starting Friday 15th June, the Boulevard Summer Show 2012 features new sets and musical numbers led by the legendary Betty Legs Diamond, performing alongside established favourites and some rather fetching new faces, all held together by the incomparable Miss Rory.",
new DateTime("2012-07-15 8:00 GMT"),
new DateTime("2012-07-15 10:00 GMT"),
"123 Example Lane, Exampleville",
"http://www.northernpink.co.uk/",
"Northern Pink"
);
?>
苹果的iCal:
<?php // Add a custom button after the event export options that display after the event content
$ical = "BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
UID:" . md5(uniqid(mt_rand(), true)) . "@yourhost.test
DTSTAMP:" . gmdate('Ymd').'T'. gmdate('His') . "Z
DTSTART:19970714T170000Z
DTEND:19970715T035959Z
SUMMARY:Bastille Day Party
END:VEVENT
END:VCALENDAR";
//set correct content-type-header
header('Content-type: text/calendar; charset=utf-8');
header('Content-Disposition: inline; filename=calendar.ics');
echo $ical;
exit;
?>
谢谢,我会尝试当我得到一分钟 –
它的工作?我认为这都是工作:) –
请让我知道它! –