微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

添加多个事件问题 iCalendar PHP

如何解决添加多个事件问题 iCalendar PHP

我可以将单个事件添加到日历中。但是我在使用 foreach 添加多个事件时遇到了问题。我在哪里犯了错误?你能帮我吗?(我从数据库提取的日期是 Y-m-d 格式。)

errror is "Some events in the calendar file could not be added. The calendar file may be corrupt."

<?PHP
require_once("zapcallib.PHP");
include('../dbcon/db.PHP');

$ical = "BEGIN:VCALENDAR\n
VERSION:2.0\n
PRODID:-//[YOUR WEBSITE],Inc.//EN\n";

foreach($db->query("SELECT * FROM rezervasyondurumu where evid='1'") as $listele) {
  $baslangic= $listele['baslangic'];
  $bitis= $listele['bitis'];
  $ical .= "\nBEGIN:VEVENT";
  $ical .= "\nUID: ".$listele['aciklama'] ." fewofethiye.com";
  $ical .= "\nDTSTAMP:" . date('Ymd');
  $ical .= "\norGANIZER:catalog@example.com";
  $ical .= "\nDTSTART:".date("Ymd",strtotime($baslangic));
  $ical .= "\nDTEND:".date("Ymd",strtotime($bitis));
  $ical .= "\nSUMMARY:".$listele['aciklama'];
  $ical .= "\nDESCRIPTION:" .$listele['aciklama'];
  $ical .= "\nEND:VEVENT";

}

$ical .= "\nEND:VCALENDAR";

header("Content-type: text/calendar; charset=utf-8");
header("Content-disposition: inline; filename=calendar.ics");
echo $ical;
?>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。