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'を呼び出す前に' return'するので、 – tkausl
これが実際のコードであれば、あなたはあなたが___returning to____であると思いますか?その関数ではないので戻りません。 – RiggsFolly
これはメール添付に関する別の回答から取られた作業コードです。私はあなたの助言を取り、「復帰」を削除しました。ありがとう@ RiggsFolly !!! – Greg