gpt4 book ai didi

php - Window.Open 在 chrome 中打开 popus 和新选项卡

转载 作者:行者123 更新时间:2023-11-28 08:56:59 25 4
gpt4 key购买 nike

我在 chrome 中遇到一个奇怪的问题,我使用 window.open 打开一个新选项卡并使用 tcpdf 创建 pdf,然后将其作为附件发送到特定地址,现在在 chrome 中发生的情况是它发送了 2 封邮件。如果启用了弹出窗口,那么我会得到 2 个窗口操作 1. 弹出窗口和 2. 新选项卡,首先我不明白这怎么可能,我从来没有见过这个。

然后,如果禁用弹出窗口,它只会在新选项卡中打开,但仍然是 2 封邮件。

下面提到了用于调用弹出页面的代码和电子邮件代码。请帮忙。

window.open('/loancal/rhexportemail.php' + qstring,"_blank");
//Code used to open popup

//------------- EMAIL CODE ----------------//
$to = "someone@gamil.com";
$from = "info@mydomain.com";
$subject = "Loan Enquiry Calculation Cashback - " . $client;
$message = "Please find attached Loan Enquiry Calculation Cashback statement for ".$client."." ;

//a random hash will be necessary to send mixed content
$separator = md5(time());

// carriage return type (we use a PHP end of line constant)
$eol = PHP_EOL;

// attachment name
$filename = $subject.".pdf";

// encode data (puts attachment in proper format)
$pdfdoc = $pdf->Output('LECC'.$separator.'.pdf', 'S');
$attachment = chunk_split(base64_encode($pdfdoc));

// encode data (multipart mandatory)
$headers = "From: ".$from.$eol;
$headers .= "MIME-Version: 1.0".$eol;
$headers .= "Content-Type: multipart/mixed; boundary=\"".$separator."\"".$eol.$eol;
$headers .= "Content-Transfer-Enconding: 7bit".$eol;
$headers .= "This is a MIME encoded message.".$eol.$eol;

// message
$headers .= "--".$separator.$eol;
$headers .= "Content-Type: text/html; charsrt=\"iso-8859-1\"".$eol;
$headers .= $message.$eol.$eol;

// attachment
$headers .= "--".$separator.$eol;
$headers .= "Content-Type: application/octet-stream; name=\"".$filename."\"".$eol;
$headers .= "Content-Transfer-Encoding: base64".$eol;
$headers .= "Content-Disposition: attachment".$eol.$eol;
$headers .= $attachment.$eol.$eol;
$headers .= "--".$separator."--";

// send message
if(@mail($to, $subject, $message, $headers))
{

echo "<script type='text/javascript'> alert('mail sent');window.close();</script>";

}
else{
echo "<script type='text/javascript'>alert('mail not sent');window.close(); </script>";
}

最佳答案

我坚信您以某种方式调用了两次。

关于php - Window.Open 在 chrome 中打开 popus 和新选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18332831/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com