Wordpress 此电子邮件代码有效,但无法重定向到“推荐人”页面
我正在使用wordpress和class。这将成功发送带有预期附件的电子邮件。问题是它没有重定向回表单所在的页面。表单为普通wordpress模板页面的页面Wordpress 此电子邮件代码有效,但无法重定向到“推荐人”页面,wordpress,phpmailer,Wordpress,Phpmailer,我正在使用wordpress和class。这将成功发送带有预期附件的电子邮件。问题是它没有重定向回表单所在的页面。表单为普通wordpress模板页面的页面 global $wpdb; require_once('../../../../wp-load.php'); get_template_part( 'email/PHPMailer-master/class.phpmailer'); $testvar = $_POST['test']; $bodytext = 'Here is a va
global $wpdb;
require_once('../../../../wp-load.php');
get_template_part( 'email/PHPMailer-master/class.phpmailer');
$testvar = $_POST['test'];
$bodytext = 'Here is a value in the variable...'.$testvar;
$email = new PHPMailer();
$email->From = 'someone@example.com';
$email->FromName = 'Spider Man';
$email->Subject = 'This is the subject of the message';
$email->Body = $bodytext;
$email->AddAddress( 'xxxxxxxxxx@gmail.com' );
$file_to_attach = get_template_directory().'/images/test.pdf';
$email->AddAttachment( $file_to_attach , 'test.pdf' );
return $email->Send();
$Referer = $_SERVER['HTTP_REFERER'];
header('Location: '. $Referer );
HTML
<form method="post" action="Path/to/email_test.php">
<input type="hidden" name="test" value="<?php echo 'BAZINGA';?>">
<input type="submit" value="SEND EMAIL">
</form>
返回$email->Send()
在它到达$Referer页面
行之前,你还没有返回吗?我想标题('Location:'。$Referer)代码>应该是要执行的最后一行。。??也许你是对的。在你回来之前把它放好。我不是php程序员,而是Perl程序员。但不知怎么的,它看起来很熟悉。一旦你点击了return
之后的任何东西都是死代码。