尝试在电子邮件中打印一系列预订。
PHP 如下所示:
<?php
$checkbooking = $_POST['checkbooking']; // <--string of bookings separated by commas
$bookings = explode(',', $checkbooking); // <-- removing the commas
$to = "myemail@email.com";
$subject = 'list of bookings';
$headers = "From: do not reply" . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message .= "Booking Report<br /><br>";
$message .= '<html><body>';
$message .= '<h3>NVR Bookings</h3><br />';
$message .= foreach($bookings as $v){echo $v . "\n";}.'<br />'; // <-- my attempt to print the bookings
$message .= '<br />';
$message .= '<body></html>';
mail($to, $subject, $message, $headers);
?>
您在邮件中看到的 foreach 循环在电子邮件功能之外工作。但是一旦我把它放在电子邮件中,我就得到了一个500错误,这确实被隔离在电子邮件功能中的foreach中。
如何更新电子邮件功能或foreach循环,以成功地连续显示预订?
慕慕森
慕田峪7331174