Luc*_*ano 3 php error-log html-email
php 函数 error_log() 允许您将日志发送到电子邮件,将第二个参数设置为 1。我这样做了,但我想在 html 中显示消息。代码如下所示:
error_log($this->_errorMsg, 1, ADMIN_MAIL, "Content-Type: text/html; charset=utf8\r\nFrom: ".MAIL_ERR_FROM."\r\nTo: ".ADMIN_MAIL);
Run Code Online (Sandbox Code Playgroud)
可能我在声明内容类型时搞砸了,因为我以纯文本形式收到 msg:
<h1>Website Error</h1>
<b>ERRNO:</b><font color='red'>1</font>
...
Run Code Online (Sandbox Code Playgroud)
您应该阅读 PHP 参考中关于error_log的注释,其中第一个包含示例:
error_log("<html><h2>stuff</h2></html>",1,"eat@joe.com","subject :lunch\nContent-Type: text/html; charset=ISO-8859-1");
Run Code Online (Sandbox Code Playgroud)
error_log("MESSAGE", 1,"email@email.com","From: webmaster@example.com");
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
8236 次 |
最近记录: |