PHP配置把错误日志以邮件方式发送方法(Windows系统),php日志_PHP教程

WBOY
Release: 2016-07-13 09:48:46
Original
972 people have browsed it

PHP配置把错误日志以邮件方式发送方法(Windows系统),php日志

当系统发生了很严重的问题,需要立刻发送给管理员。可以通过 error_log() 将错误以邮件形式发送到邮箱。

在 php.ini 中设置:
复制代码 代码如下:
sendmail_from = 472323087@qq.com

然后设置:
复制代码 代码如下:
sendmail_path = "G:\sendmail\sendmail.exe -t"

其中:G:\sendmail\sendmail.exe 是邮件客户端的地址。

 代码:

复制代码 代码如下:
//关闭错误显示
ini_set('display_errors', 0);
//开启错误日志功能
ini_set('log_errors', 'on');
//显示所有错误
error_reporting(-1);

//发送错误
error_log('当前系统被攻击,产生了致命错误', 1, '472323087@qq.com'); //参数 1 表示以邮件形式发送错误

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1021090.htmlTechArticlePHP配置把错误日志以邮件方式发送方法(Windows系统),php日志 当系统发生了很严重的问题,需要立刻发送给管理员。可以通过 error_log() 将...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!