Php 如何限制这个对象(stdClass)#5(2){[";errorNumber";]=>;int(0)[";scriptResult";]=>;对象(stdClass){6(0)}
我正在使用PHPMailer根据用户输入从我的站点发送电子邮件。 我被唱这首歌。虽然我能够发送电子邮件,所需的工作已经完成,但是,我在网页上看到了这一点 对象(stdClass)#5(2){[“errorNumber”]=>int(0)[“scriptResult”]=>object(stdClass)#6(0){} 我正在使用gmail发送电子邮件。我对PHP非常陌生Php 如何限制这个对象(stdClass)#5(2){[";errorNumber";]=>;int(0)[";scriptResult";]=>;对象(stdClass){6(0)},php,email,gmail,phpmailer,stdclass,Php,Email,Gmail,Phpmailer,Stdclass,我正在使用PHPMailer根据用户输入从我的站点发送电子邮件。 我被唱这首歌。虽然我能够发送电子邮件,所需的工作已经完成,但是,我在网页上看到了这一点 对象(stdClass)#5(2){[“errorNumber”]=>int(0)[“scriptResult”]=>object(stdClass)#6(0){} 我正在使用gmail发送电子邮件。我对PHP非常陌生 public function sendorderemail() { //SMTP needs accurate ti
public function sendorderemail() {
//SMTP needs accurate times, and the PHP time zone MUST be set
//This should be done in your php.ini, but this is how to do it if you don't have access to that
date_default_timezone_set('Etc/UTC');
require '../mail/PHPMailerAutoload.php';
// Stop error reporting
error_reporting(0);
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 0;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
$mail->IsHTML(true);
//Set the hostname of the mail server
$mail->Host = 'smtp.gmail.com';
//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
$mail->Port = 587;
//Set the encryption system to use - ssl (deprecated) or tls
$mail->SMTPSecure = 'tls';
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Username to use for SMTP authentication - use full email address for gmail
$mail->Username = "xxx@gmail@gmail.com";
//Password to use for SMTP authentication
$mail->Password = "xxxxxxxx";
//Set who the message is to be sent from
$mail->setFrom('xxx@gmail.com', 'MyCompany A/S');
//Set an alternative reply-to address
$mail->addReplyTo('xxx@gmail.com', 'MyCompany A/S');
//Set who the message is to be sent to
$mail->addAddress('xxxx@MyCompany.dk', 'xxx xxxx');
//$mail->addAddress('xxxxx@MyCompany.dk', 'xxxx xxxx');
if($this->kundeemail != ""){
$mail->addAddress($this->kundeemail,$this->kunderekvirent);
}
//Set the subject line
$mail->Subject = "robot@MyCompany.dk - don't reply.";
//Attach the image files
$mail->addAttachment($this->fil1);
$mail->addAttachment($this->fil2);
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->Body = '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
body,td,th {
font-family: Arial;
font-size: 11px;
}
</style>
</head>
<body>
<p>Tak for din bestilling.<br />
<br />
Du har bestil '.$this->antal.' stk. med følgende oplysninger:<br />'.$this->kommentar.'</p>
<h3>Preview</h3>
<p>Forside:</p>
<p><img class="previewimage" width="250px" style="border:1px solid #cecece; " src="http://web2MyCompany.dk/uploads/'.$this->fil1.'" /></p>
<p>Bagside:</p>
<p><img class="previewimage" width="250px" style="border:1px solid #cecece; " src="http://web2MyCompany.dk/uploads/'.$this->fil2.'" /></p>
<h3>Fakturaadresse</h3>
<table width="400" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Firmanavn</th>
<td>'.$this->kundefirmanavn.'</th>
</tr>
<tr>
<td>CVR Nr.</td>
<td>'.$this->kundecvr.'</td>
</tr>
<tr>
<td>Telefon Nr.</td>
<td>'.$this->kundetelefon.'</td>
</tr>
<tr>
<td>Rekvirent</td>
<td>'.$this->kunderekvirent.'</td>
</tr>
<tr>
<td>Adresse</td>
<td>'.$this->kundeadresse.'</td>
</tr>
<tr>
<td>Postnr. & By</td>
<td>'.$this->kundepostnr.' '.$this->kundeby.'</td>
</tr>
<tr>
<td>E-mail</td>
<td>'.$this->kundeemail.'</td>
</tr>
</table>
<h3>Leveringsadresse</h3>
<table width="400" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Firmanavn</th>
<td>'.$this->leveringfirmanavn.'</th>
</tr>
<tr>
<td>CVR Nr.</td>
<td>'.$this->leveringcvr.'</td>
</tr>
<tr>
<td>Telefon Nr.</td>
<td>'.$this->leveringtelefon.'</td>
</tr>
<tr>
<td>Rekvirent</td>
<td>'.$this->leveringrekvirent.'</td>
</tr>
<tr>
<td>Adresse</td>
<td>'.$this->leveringadresse.'</td>
</tr>
<tr>
<td>Postnr. & By</td>
<td>'.$this->leveringpostnr.' '.$this->leveringby.'</td>
</tr>
<tr>
<td>E-mail</td>
<td>'.$this->leveringemail.'</td>
</tr>
</table>
<p>Med venlig hilsen</p>
<p>MyCompany A/S</p>
</body>
</html>
';
//Replace the plain text body with one created manually
$mail->AltBody = 'MyCompany A/S';
//send the message, check for errors
if (!$mail->send()) {
echo "Error in Sending Email";
} else {
echo "Email Sent Successfully";
}
}
公共函数sendorderemail(){
//SMTP需要准确的时间,并且必须设置PHP时区
//这应该在您的php.ini中完成,但如果您没有访问权限,就应该这样做
日期\默认\时区\设置('Etc/UTC');
需要“../mail/phpmailerautoad.php”;
//停止错误报告
错误报告(0);
//创建新的PHPMailer实例
$mail=新的PHPMailer;
//告诉PHPMailer使用SMTP
$mail->isSMTP();
//启用SMTP调试
//0=关闭(用于生产使用)
//1=客户端消息
//2=客户端和服务器消息
$mail->SMTPDebug=0;
//请求HTML友好的调试输出
$mail->Debugoutput='html';
$mail->IsHTML(true);
//设置邮件服务器的主机名
$mail->Host='smtp.gmail.com';
//为经过身份验证的TLS(又称RFC4409 SMTP提交)设置SMTP端口号-587
$mail->Port=587;
//将加密系统设置为使用-ssl(已弃用)或tls
$mail->SMTPSecure='tls';
//是否使用SMTP身份验证
$mail->SMTPAuth=true;
//用于SMTP身份验证的用户名-使用gmail的完整电子邮件地址
$mail->Username=”xxx@gmail@gmail.com“;
//用于SMTP身份验证的密码
$mail->Password=“xxxxxxxx”;
//设置要从谁发送消息
$mail->setFrom('xxx@gmail.com“我的公司A/S”);
//将替代答复设置为地址
$mail->addReplyTo('xxx@gmail.com“我的公司A/S”);
//设置要向谁发送邮件
$mail->addAddress('xxxx@MyCompany.dk","xxx xxxx";;
//$mail->addAddress('xxxxx@MyCompany.dk“,”xxxx xxxx“);
如果($this->kundeemail!=“”){
$mail->addAddress($this->kundeemail,$this->kunderekvirent);
}
//设置主题行
$mail->Subject=”robot@MyCompany.dk-不要回答。”;
//附加图像文件
$mail->addAttachment($this->fil1);
$mail->addAttachment($this->fil2);
//从外部文件读取HTML消息正文,将引用的图像转换为嵌入的,
//将HTML转换为基本的纯文本替换体
$mail->Body=
无标题文件
正文,td,th{
字体系列:Arial;
字体大小:11px;
}
用于din填充的Tak。
杜哈尔·贝斯蒂尔。$this->antal。'stk.med fø;lgende oplysninger:
。$this->kommentar。'
预览
Forside:
fil1.“/>
袋边:
fil2.“/>
fakturaadrese
菲尔马纳夫
“.$this->kundefirmanavn”
CVR号。
“.$this->kundecvr”
电话号码。
“.$this->kundetelefon”
雷克维伦特
“.$this->kunderekvirent”
阿迪斯
“.$this->kundaderess”
邮递员
“.$this->kundepostnr.$this->kundeby”
电子邮件
“.$this->kundeemail”
勒文斯德雷斯
菲尔马纳夫
“.$this->leveringfirmanavn”
CVR号。
“.$this->leveringcvr”
电话号码。
“.$this->leveringtelefon”
雷克维伦特
“.$this->leveringrekvirent”
阿迪斯
“.$this->leveringadresse”
邮递员
“.$this->leveringpostnr.”.$this->leveringby.“
电子邮件
“.$this->leveringemail”
梅德文利格希尔森
我公司A/S
';
//将纯文本正文替换为手动创建的正文
$mail->AltBody='MyCompany A/S';
//发送消息,检查错误
如果(!$mail->send()){
回显“发送电子邮件时出错”;
}否则{
回显“电子邮件发送成功”;
}
}
从我所看到的,上面发布的代码并没有在脚本中创建输出
所描述的输出:
object(stdClass)#5(2){[“errorNumber”]=>int(0)[“scriptResult”]=>object(stdClass)#6(0){}
很可能是代码中某个地方json解码或mysqli fetch对象(或返回stdClass的类似函数)上的var_转储(或print_r)的结果
我建议您在脚本和其他“require”文件中搜索“var_dump”,并在找到罪犯后将其删除。看起来您的代码中使用了var_dump,但我在粘贴的代码中看不到它。也许代码中的其他地方