您好我正在使用PHP脚本发送邮件,并在我使用echo来显示结果。我正在通过cron运行这个脚本,它正在向我发送输出。但结果不是我已经尝试\r\n
的一行一行,但仍然没有正常工作的代码是
$emailBody= chunk_split(base64_encode($emailBody));
$headers = "From: Lotus ERP Attendance <erp@lotus.edu.in>" . "\r\n";
$headers .= "Reply-To: erp@lotus.edu.in\r\n";
$headers .= "Return-Path: erp@lotus.edu.in\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= "Content-Transfer-Encoding: base64\r\n\r\n";
if(mail($to, $subject, $emailBody, $headers)) {
echo 'Success:';
echo '-----';
echo $row['enroll_no'];
echo '-----';
echo $row['First_Name'];
echo ' ';
echo $row['Last_Name'];
echo '-----';
echo 'Email sent successfully!\r\n';
} else {
}
}
else {
echo 'Failure:';
echo '-----';
echo $row['enroll_no'];
echo '-----';
echo $row['First_Name'];
echo ' ';
echo $row['Last_Name'];
echo '-----';
echo 'Failure: Email was not sent!\r\n';
}
我收到邮件的结果是
/usr/lib/php/modules/xcache.so doesn't appear to be a valid Zend extension
Success:-----1103106-----HARI SINGH-----Email sent successfully!\r\nSuccess:-----1103107-----MUNENDRA KUMAR-----Email sent successfully!\r\nSuccess:-----1103110-----TARUN UPADHYAY-----Email sent successfully!\r\nSuccess:-----1103111-----SHUBHAM SAXENA-----Email sent successfully!\r\nSuccess:-----1103112-----SANA JAHAN-----Email sent successfully!\r\nSuccess:-----1103122-----SAIF WASEEM-----Email sent successfully!\r\nSuccess:-----1103124-----AMIR KHAN(A)-----Email sent successfully!\r\nSuccess:-----1103126-----HINA ZAHRA-----Email sent successfully!\r\nSuccess:-----1103127-----AMAN KUMAR KASHYAP-----Email sent successfully!\r\nSuccess:-----1103128-----MADAN SINGH MEHTA-----Email sent successfully!\r\nSuccess:-----1103129-----PRIYAMVADA MISHRA-----Email sent successfully!\r\nSuccess:-----1103133-----HITESH KUMAR PAHWA-----Email sent successfully!\r\nSuccess:-----1103134-----FAIZ AHMAD-----Email sent successfully!\r\nSuccess:-----1103135-----ABDUL SAMAD-----Email sent successfully!\r\nSuccess:-----1103137-----SHEFALI AGARWAL-----Email sent successfully!\r\nSuccess:-----1103139-----JITENDRA MISHRA-----Email sent successfully!\r\nSuccess:-----1103155-----ZAFAR .-----Email sent successfully!\r\n
我想逐行排列这个错误/usr/lib/php/modules/xcache.so doesn't appear to be a valid Zend extension
答案 0 :(得分:1)
将\ n置于“not”内,然后重试。我认为这是正确的方法。
echo "whatever \n";