我有3个字符串,我从早期的PHP中获得。它们实际上是在脚本的早期成功使用的,但是当它们到达电子邮件功能时它会失败,如下所示:
$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";
答案 0 :(得分:0)
你可以使用
string mb_convert_encoding ( string $str , string $to_encoding [, mixed $from_encoding = mb_internal_encoding() ] )
将字符串 str 的字符编码从 from_encoding 转换为 to_encoding 。
如果未指定 from_encoding ,则将使用内部编码。
答案 1 :(得分:0)
试试这个
$vagup = filter_input(INPUT_GET, 'vagup', FILTER_DEFAULT);
$misto = filter_input(INPUT_GET, 'misto', FILTER_DEFAULT);
$nampao = filter_input(INPUT_GET, 'nampao', FILTER_DEFAULT);