English 中文(简体)
PHP: iCal creation, how to make a new line in a presentation
原标题:PHP: iCal creations, how to make a new line in a description

I m using the following to create a calendar invite for outlook for a php script. However the doesn t give me a new line in outlook. Is there a way to do this? Seems silly if you can t!

  function addToCalendar($calEmail, $calSubject, $calDesc) 
  {

$calEmail =  [email protected] ;
$description = $calDesc;
$message="BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:20110718T121000Z
DTEND:20110718T131000Z
DTSTAMP:20110525T075116Z
ORGANIZER;CN=TOMS TEST:mailto:[email protected]
UID:12345678
ATTENDEE;PARTSTAT=NEEDS-ACTION;RSVP= TRUE;CN=Yup:mailto:[email protected]
DESCRIPTION New 
 Line
LOCATION: I AM THE LOCATION
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY: TEST SUMMARY
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR";

$headers = "From: From Name <From Mail>
";
$headers .= "MIME-Version: 1.0
";
$headers .= "Content-Type: text/calendar; method=REQUEST;
";
$headers .=          charset="UTF-8" ;
$headers .= "
";
$headers .= "Content-Transfer-Encoding: 7bit";


$subject = "Meeting Subject";
$subject = html_entity_decode($calSubject, ENT_QUOTES,  UTF-8 );


if(mail($calEmail, $calSubject, $message, $headers)) {

    echo "sent";
}else {
    echo "error";
}


  }

It s the DESCRIPTION New Line part i m having issues with.

任何帮助都将受到高度赞赏。

纽约总部

最佳回答

You should replace with :

$description = str_replace("
", "\n", $description);

另见Encoding newlines in iCal file

问题回答

您可使用=0D=0A,用于与适当的编码相符的新线路:

DESCRIPTION;ENCODING=QUOTED-PRINTABLE:This is the first line.=0D=0AThe Second line.=0D=0AThe third line.

or an alternative approach (using base64):

DESCRIPTION;FMTTYPE=text/html;ENCODING=BASE64:PHA+Tm9ybWFsIDAgZmFsc2UgZmFsc2UgZmFsc2UgTWljcm9zb2Z0SW50ZXJuZXRFeHBsb3JlcjQ8L3A+DQo8YnIgY2xhc3M9ImNsZWFyIiAvPg==




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签