添加多个事件问题 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 (将#修改为@)