PHP:vcal描述为空

时间:2013-05-07 08:30:14

标签: php vcalendar

我真的需要帮助。我有这个功能:

function sendICal($dtstart,$dtend,$loc,$summary,$from,$to,$subject, $EMAIL, $uid, $decline = 0, $debug = 0) 
{

$now=date('Ymd').'T'.date('His');
$vcal = "BEGIN:VCALENDAR\r\n";
$vcal .= "VERSION:2.0\r\n";
$vcal .= "PRODID:ITAF_IMS_NL\r\n";
$vcal .="CALSCALE:GREGORIAN\r\n";

if($debug){

$aan = ',marko.vasic@itaf.eu';
}

 else {

  for($x = 0; $x < count($EMAIL); $x++){
  $aan .= ','.$to[$x];
}
}

if($decline){

  $vcal .="METHOD:REPLY\n";
  $vcal .="BEGIN:VEVENT\n";
  $vcal .="STATUS:CONFIRMED\n";
  for($x = 0; $x < count($EMAIL); $x++){
  $vcal .= "ATTENDEE;PARTSTAT=DECLINED;CN=\"\";ROLE=REQ-PARTICIPANT;RSVP=FALSE:MAILTO:".$EMAIL[$x]."\n";

  }

  $vcal .="X-WR-TIMEZONE:Europe/Brussels\n";
  $vcal .="DTSTAMP:".$now."\n";
  $vcal .="DTSTART;TZID:$dtstart\n";
  $vcal .="DTEND:".$dtend."\n";
  $vcal .="SUMMARY:Declined:".$subject."\n";
  $vcal .="SEQUENCE:1\n";
  $vcal .="X-MICROSOFT-CDO-OWNER-CRITICAL-CHANGE:$now\r\n";
  $vcal .="X-MICROSOFT-CDO-ATTENDEE-CRITICAL-CHANGE:$now\r\n";
  $vcal .="X-MICROSOFT-CDO-APPT-SEQUENCE:1\n";
  $vcal .="X-MICROSOFT-CDO-OWNERAPPTID:-1\n";
  $vcal .="X-MICROSOFT-CDO-ALLDAYEVENT:FALSE\n";
  $vcal .="END:VEVENT\n";

  } else {

  $vcal .= "METHOD:REQUEST\n";
  $vcal .= "BEGIN:VEVENT\n";
  for($x = 0; $x < count($EMAIL); $x++){
  $vcal .= "ATTENDEE;CN=\"\";ROLE=REQ-PARTICIPANT;RSVP=FALSE:MAILTO:".$EMAIL[$x]."\n";

  }

  $vcal .="CREATED:".$now."\n";
  $vcal .="X-WR-TIMEZONE:Europe/Brussels\n";
  $vcal .="LAST-MODIFIED:".$now."\n";
  $vcal .= "DTSTAMP:".$now."\n";
  $vcal .= "DTSTART:".$dtstart."\n";
  $vcal .= "DTEND:".$dtend."\n";
  $vcal .= "SUMMARY:".$subject."\n";
  $vcal .= "UID:".$uid."\n";
  if ($loc != "") $vcal .= "LOCATION:".$loc."\n";
  $vcal .= "BEGIN:VALARM\n";
  $vcal .= "TRIGGER:-PT15M\n";
  $vcal .= "ACTION:DISPLAY\n";
  $vcal .= "DESCRIPTION:Reminder:".$summary."\n";
  $vcal .= "END:VALARM\n";
  $vcal .= "END:VEVENT\n";
  } 
 $vcal .= "UID:".$uid."\n";

if ($loc != "") $vcal .= "LOCATION:".$loc."\n";
      $vcal .= "END:VCALENDAR\n";

  $headers = "From: $from\r\nReply-To: $from";
  $headers .= "\r\nMIME-version: 1.0\r\nContent-Type: text/calendar; method=REQUEST; charset=\"iso-8859-1\"";
  $headers .= "\r\nContent-Transfer-Encoding: 7bit\r\nX-Mailer: Microsoft Office     Outlook 12.0";

mail(substr($aan,1), $subject, $vcal, $headers);
 }

它应该发送事件调用。它发送除描述之外的一切。它始终将描述字段留空。无论发送什么。我从我发送的字符串中删除<br/>作为描述,它仍然发送空白字段。标题中是否有一些我没看到的错误?有谁知道如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

它是文本“Reminder”之后的冒号: - 冒号是一个特殊字符,用于界定元素名称和值,单个元素不能有多个冒号。你可以用反斜杠来逃避它,它应该是这样的:

DESCRIPTION:Reminder\:

可以在一个值中指定多行,方法是将它们与CRLF和后面的空白字符分开。