Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/262.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
在href正文中发送php变量时,我无法访问新页面中的变量_Php_Email - Fatal编程技术网

在href正文中发送php变量时,我无法访问新页面中的变量

在href正文中发送php变量时,我无法访问新页面中的变量,php,email,Php,Email,我有这个密码 $sucess_image = 'http://www.test.gr/images/message.jpg'; $body = "<a href=\"http://test.gr/print.php?orderid=\"{$orderId}\"><img src='$sucess_image' /></a>"; $from = "<test@test.gr>"; $to = "&l

我有这个密码

$sucess_image = 'http://www.test.gr/images/message.jpg';
$body         = "<a href=\"http://test.gr/print.php?orderid=\"{$orderId}\"><img src='$sucess_image' /></a>";
$from         = "<test@test.gr>";
$to           = "<$email>";
$subject      = 'test';
$newsubject   = '=?ISO-8859-7?B?' . base64_encode($subject) . '?=';
$host         = "test.gr";
$username     = "info@test.gr";
$password     = "xxx";
$headers      = array(
    'MIME-Version' => '1.0"\r\n"',
    'Content-Type' => 'text/html; charset=UTF-8"\r\n"',
    'Content-Transfer-Encoding: quoted-printable' => 'base64',
    'From' => $from,
    'To' => $to,
    'Cc' => $cc,
    'Subject' => $newsubject
);
$smtp         = Mail::factory('smtp', array(
    'host' => $host,
    'auth' => true,
    'username' => $username,
    'password' => $password
));
$mail         = $smtp->send($to, $headers, $body);
$sucess\u image=”http://www.test.gr/images/message.jpg';
$body=“”;
$from=“”;
$to=“”;
$subject='test';
$newsubject='=?ISO-8859-7?B?'。base64_编码($subject)。“?=”;
$host=“test.gr”;
$username=”info@test.gr";
$password=“xxx”;
$headers=数组(
“MIME版本”=>“1.0”\r\n”,
“内容类型”=>“文本/html;字符集=UTF-8”\r\n“,
'内容传输编码:带引号的可打印'=>'base64',
'From'=>$From,
'至'=>$至,
“Cc”=>Cc美元,
“主题”=>$newsubject
);
$smtp=Mail::工厂('smtp',数组(
“主机”=>$host,
“auth”=>正确,
“用户名”=>$username,
“密码”=>$password
));
$mail=$smtp->send($to、$headers、$body);

在test.gr/print.php中,orderid为空,问题是当我将该变量发送到电子邮件时,该变量有值,代码中是否存在任何问题,并且我无法传递该变量?

您的字符串格式不正确-

 $body ="<a href=\"http://test.gr/print.php?orderid={$orderId}\"><img src='$sucess_image' /></a>";

介意格式化你的代码吗?很抱歉,我不知道如何格式化它为您格式化谢谢帮助@hd
send($to,$headers,$body)
-头通常排在最后。语法是:“to,subject,message,headers”<代码>变量转储($body)显示什么?那么,
$orderId
的值是多少?如果我这样做,我有一个问题:取而代之。这意味着我丢失了这个符号“=”和数字“3”的第一个数字,然后你在其他地方有另一个问题!
$body ="<a href='http://test.gr/print.php?orderid=".$orderId."'><img src='".$sucess_image."' /></a>";
'Content-Transfer-Encoding: quoted-printable' => 'base64',