Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress 此电子邮件代码有效,但无法重定向到“推荐人”页面_Wordpress_Phpmailer - Fatal编程技术网

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

我正在使用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 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
之后的任何东西都是死代码。