【发布时间】:2014-11-25 09:17:20
【问题描述】:
我希望使用 php 邮件调试信息在网页中显示。当我启用调试时,它只是回显字符串。这意味着我的 html 出现故障,因此我希望将其作为变量输出,以便将输出 html 放置在我想要的位置。
$mail->SMTPDebug = 2;
$mail->Debugoutput = 'html';
【问题讨论】:
我希望使用 php 邮件调试信息在网页中显示。当我启用调试时,它只是回显字符串。这意味着我的 html 出现故障,因此我希望将其作为变量输出,以便将输出 html 放置在我想要的位置。
$mail->SMTPDebug = 2;
$mail->Debugoutput = 'html';
【问题讨论】:
PHPMailer allows Debugoutput to be a closure 的最新更改,因此您可以让它做任何您喜欢的事情,例如收集所有调试输出并稍后发出:
$debug = '';
$mail->Debugoutput = function($str, $level) {
$GLOBALS['debug'] .= "$level: $str\n";
};
//...later
echo $debug;
【讨论】:
}后面少了一个;吗?