【发布时间】:2014-11-26 10:24:27
【问题描述】:
我有 3 个字符串,这些字符串是从我的 php.ini 中获取的。它们实际上在脚本的早期使用成功,但是当它们使用电子邮件功能时,它会失败,如下所示:
$vagup = $_GET['vagup'];
$misto = $_GET['misto'];
$nampao = $_GET['nampao'];
$staement = $dbh->prepare('SELECT earlybird FROM databaser WHERE mastppp = :fasto AND feats = :gamerop');
$staement->execute( array( 'fasto' => $misto, 'gamerop' => $nampao ) );
$results = $staement->fetch(PDO::FETCH_ASSOC);
$masto = $results['earlybird'];
$to = $masto;
$subject = 'Paid $'. $vagup . ' from the script';
$message = 'This is a receipt for your payment of $'. $vagup . ' from the script';
$headers = 'From: theemail@gmail.com' . "\r\n" .
'Reply-To: theemail@gmail.com' . "\r\n".
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
$staement = $dbh->prepare('SELECT stain FROM databaser WHERE mastppp = :fasto AND feats = :gamerop');
$staement->execute( array( 'fasto' => $misto, 'gamerop' => $nampao ) );
$results = $staement->fetch(PDO::FETCH_ASSOC);
$masto = $results['stain'];
$to = $masto;
$subject = $nampao .' paid $'. $vagup . ' from the script';
$message = 'This is a receipt for the payment of $'. $vagup . ' from the script by '. $nampao;
$headers = 'From: theemail@gmail.com' . "\r\n" .
'Reply-To: theemail@gmail.com' . "\r\n".
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
奇怪的是,当我插入虚拟字符串时,它就可以工作了。
$vagup = "rambo";
$misto = "mistoblue";
$nampao = "heyu";
【问题讨论】:
-
编码后传递邮件。
-
这些变量真的和你认为的一样吗?尝试回显它们或错误记录它们以确保。
-
确实如此。刚做了。这几乎就像他们与邮寄或其他东西发生冲突。
-
当您在查询字符串中传递电子邮件时对其进行编码。
-
我该怎么做?