我有这个代码正在运行,但现在它失败了......
$v = new vcalendar(); // create a new calendar instance
$v->setConfig('unique_id', 'myWebsite'); // set Your unique id
$v->setProperty('method', 'PUBLISH'); // required of some calendar software
foreach ($valid_request as $key => $value) {
$start_date = explode('-', $value->start);
$start_time = explode(':', $value->from_time);
$end_time = explode(':', $value->to_time);
$vevent = new vevent(); // create an event calendar component
$vevent->setProperty('dtstart', array('year' => $start_date[0], 'month' => $start_date[1], 'day' => $start_date[2], 'hour' => $start_time[0], 'min' => $start_time[1], 'sec' => $start_time[2]));
$vevent->setProperty('dtend', array('year' => $start_date[0], 'month' => $start_date[1], 'day' => $start_date[2], 'hour' => $end_time[0], 'min' => $end_time[1], 'sec' => $end_time[2]));
$vevent->setProperty('LOCATION', $_SESSION["location"]); // property name - case independent
$vevent->setProperty('summary', $value->title);
$v->setComponent($vevent); // add event to calendar
}
//print_r($v);
$v->returnCalendar(); // redirect calendar file to browser
我遇到的问题是当我转到它生成的.ics文件时,它们是文件开头的空格。
*space here*
BEGIN:VCALENDAR
METHOD:PUBLISH
PRODID:-//myWebsite//NONSGML iCalcreator 2.4.3//
VERSION:2.0
BEGIN:VEVENT
//then the rest of the code
如果我手动进入并删除空间并尝试手动导入它有效,那么我很好奇是否有人知道我的问题是什么或者这是一个错误。