我遇到了一個使用PHPmailer的問題,我只是不明白。對於在所示位置100%工作的標題功能,我有一個輔助功能重定向。它不能在我希望它工作的評論中顯示的位置上工作。無論放置重定向功能的位置如何,其他所有功能都能正常工作。有任何想法嗎?這也是我的第一篇文章,如果已經有我找不到的解決方案,請提前致歉。PHP郵件程序重定向問題
<?php
if(isset($_POST['replyall'])) {
redirect("index.php?leadreply"); // Why does this have to be here to work???? //
if(isset($_POST['chk1'])) {
$email = new PHPMailer();
$email->From = $_POST['author'];
$email->FromName = 'JGM Decorating';
$email->Subject = 'Reply to your contact request';
$email->Body = $_POST['comments'];
$email->AddAddress($_POST['destination']);
$file_to_attach = '../crm/gtcjgm.pdf';
$email->AddAttachment($file_to_attach , 'Terms and Conditions.pdf');
return $email->Send();
// I would like to have the redirect here but it doesn't work??//
} else {
$email = new PHPMailer();
$email->From = $_POST['author'];
$email->FromName = 'JGM Decorating';
$email->Subject = 'Reply to your contact request';
$email->Body = $_POST['comments'];
$email->AddAddress($_POST['destination']);
$file_to_attach = '';
$email->AddAttachment($file_to_attach , 'Terms and Conditions.pdf');
return $email->Send();
// I would like to have a different redirect here but it doesn't work??//
}
}
?>
因爲你在調用'redirect'之前'返回'。 – tkausl
如果這是真正的代碼,你怎麼認爲你___returning to___它不是一個函數,以便返回時沒有SENCE – RiggsFolly
這從有關郵件附件另一個答案是採取工作代碼。我接受了你的建議並刪除了「返回」。完全按照我想要的那樣工作@RiggsFolly! – Greg