代碼:
// Attach two files: an image and a zip archive
// - Each element contains: "file path", "file mime type"
$attach[] = array('$image', 'image/jpeg');
// Calls the sendMailAtt() to send mail, outputs message if the mail was accepted for delivery or not
if(sendMailAtt($to, $from, $subject, $message, $attach)) {
echo 'The mail successfully sent';
}
如果你看一下$attach[]...
線,array $image
無法正常工作。 如果將其更改爲:image.jpg
,則可以使用。但簡單的$image
(通過網站上傳產生)通過郵件發送時爲0字節。
有什麼我必須改變這一行,所以它使用這個數組中生成的$圖像名稱?
單引號內**變量將不會被intrepreted * * –
您是否使用本地php'mail()'函數或其他庫來發送電子郵件?看看這個普通的'mail()'函數來發送附件。 http://webcheatsheet.com/php/send_email_text_html_attachment.php – Latheesan