我的代码正在运行,但唯一的事情$todaystamp
显示在我的时钟前3小时。我想解决它。 (格林威治标准时间+3)我仍然想使用gmdate
方法,因为我不知道如何更改其余部分...如何在不破坏其他代码的情况下执行此操作?谢谢...
<?php
function sendIcalEmail($firstname,$lastname,$email,$meeting_date,$meeting_name,$meeting_duration,$message1,$place1) {
$from_name = "Furkan Öksüz";
$from_address = "furk.oksuz4@gmail.com";
$subject = "Olusturulan Etkinlik"; //Doubles as email subject and meeting subject in calendar
$meeting_description = $message1;
$meeting_location = $place1; //Where will your meeting take place
//Convert MYSQL datetime and construct iCal start, end and issue dates
$meetingstamp = strtotime($meeting_date . " UTC");
$dtstart= gmdate("Ymd\THis\Z",$meetingstamp);
$dtend= gmdate("Ymd\THis\Z",$meetingstamp+$meeting_duration);
$todaystamp = gmdate("Ymd\THis\Z",strtotime("+3 hours"));
$cal_uid = date('Ymd').'T'.date('His')."-".rand()."@mydomain.com";
//Create Mime Boundry
$mime_boundary = "----Meeting Booking----".md5(time());
//Create Email Headers
$headers = "From: ".$from_name." <".$from_address.">\n";
$headers .= "Reply-To: ".$from_name." <".$from_address.">\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n";
$headers .= "Content-class: urn:content-classes:calendarmessage\n";
//Create Email Body (HTML)
$message .= "--$mime_boundary\n";
$message .= "Content-Type: text/html; charset=UTF-8\n";
$message .= "Content-Transfer-Encoding: 8bit\n\n";
$message .= "<html>\n";
$message .= "<body>\n";
$message .= '<p>Merhaba '.$firstname.' '.$lastname.',</p>';
$message .= $message1;
$message .= "</body>\n";
$message .= "</html>\n";
$message .= "--$mime_boundary\n";
$ical = 'BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN
VERSION:2.0
METHOD:PUBLISH
BEGIN:VEVENT
ORGANIZER:MAILTO:'.$from_address.'
DTSTART:'.$dtstart.'
DTEND:'.$dtend.'
LOCATION:'.$meeting_location.'
TRANSP:OPAQUE
SEQUENCE:0
UID:'.$cal_uid.'
DTSTAMP:'.$todaystamp.'
DESCRIPTION:'.$meeting_description.'
SUMMARY:'.$subject.'
PRIORITY:5
CLASS:PUBLIC
END:VEVENT
END:VCALENDAR';
$message .= 'Content-Type: text/calendar;name="meeting.ics";method=REQUEST;charset=utf-8\n';
$message .= 'Content-Type: text/calendar;name="meeting.ics";method=REQUEST\n';
$message .= "Content-Transfer-Encoding: 8bit\n\n";
$message .= $ical;
//SEND MAIL
$mail_sent = @mail( $email, $subject, $message, $headers );
if($mail_sent) {
return true;
} else {
return false;
}
}
?>