大佬教程收集整理的这篇文章主要介绍了php-如何从字面上发布此图标:&,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
你好
我正在尝试将长文本发布到另一台服务器以发送电子邮件,但是当服务器发送电子邮件时,我没有得到我希望得到的:
连接的文件:
$id = $user_index->lasdID(); $key = base64_encode($id); $id = $key; $code = file_get_contents("PRIVATE"); $link = "http://sosgram.ga/account/access/verify.PHP?id='$id'&code=$code"; $message = " <b>Hola $fullname, <br> Bienvenido a SOSgram</b><br><br> Para completar su registro, simplemente clique en el siguiente link de verificación<br><br> <a target='_blank' href='$link'>Clique aquí para activar la cuenta :)</a> <br><br><br> <i>Muchas gracias,<br> SOSgram</i>"; $subject = "Confirmar Registro en SOSgram"; $user_index->send_mail($email,$message,$subject); $msg = "<div class='alert alert-success fade in'> <a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a> <strong>Enhorabuena!</strong> Su registro se ha completado correctamente.<br> En breve recibirá un email con un link de confirmación de su cuenta </div>";
@H_674_13@我只发布了导致我出错的代码,因为我检查了其他代码,并且效果很好
function send_mail($email,$message,$subject) { $url = 'PRIVATE/email.PHP'; $myvars = 'email=' . $email . '&message=' . $message . '&subject=' . $subject; $ch = curl_init( $url ); curl_setopt( $ch, CURLOPT_POST, 1); curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt( $ch, CURLOPT_HEADER, 0); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec( $ch ); }
@H_674_13@
if ($_POST['email'] and $_POST['subject'] and $_POST['message']) { date_default_timezone_set('Etc/UTC'); require 'mailer/@L_83_5@mailerAutoload.PHP'; $mail = new @L_83_5@mailer; $email = $_POST['email']; $subject = $_POST['subject']; $message = $_POST['message']; $mail->isSMTP(); $mail->CharSet = 'UTF-8'; $mail->SMTPDebug = 2; $mail->Debugoutput = 'html'; $mail->Host = "smtp.sparkpostmail.com"; $mail->Port = 587; $mail->SMTPAuth = true; $mail->Username = "SMTP_Injection"; $mail->password = "PRIATE"; $mail->setFrom('verify@email.sosgram.ga', 'Verificación de Cuentas | SOSgram'); $mail->addReplyTo('support@email.sosgram.ga', 'Soporte | SOSgram'); $mail->addAddress("$email"); $mail->Subject = "$subject"; $mail->msgHTML("$message"); if (!$mail->send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "message sent!"; } } else {echo "Bad request";}
@H_674_13@我认为错误是在后方法中,服务器发送消息时,它将链接http://sosgram.ga/account/access/verify.PHP?id=’$id’\u0026amp;code=$code解释为两个独立的post方法,因为它具有&图标,因此它会修剪文本并仅发送消息,直到&
如何强制$_POST方法发送图标&作为图标而不是方法中的分隔符?
谢谢
解决方法:
和
或者,使用
http_build_query
:
$base_url = "http://sosgram.ga/account/access/verify.PHP?"; $query = http_build_query(Array( id => "'$id'", # Are you sure you want to surround the id with apostrophes? code => $code )); $link = $base_url . $query;
@H_674_13@大佬总结
以上是大佬教程为你收集整理的php-如何从字面上发布此图标:&全部内容,希望文章能够帮你解决php-如何从字面上发布此图标:&所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。