且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在生产服务器上抑制 php 错误的***方法

更新时间:2023-08-21 13:30:22

***的方法是记录您的错误,而不是显示或忽略它们.

The best way is to log your errors instead of displaying or ignoring them.

此示例会将错误记录到系统日志中,而不是在浏览器中显示它们.

This example will log the errors to syslog instead of displaying them in the browser.

ini_set("display_errors", 0);
ini_set("log_errors", 1);

//Define where do you want the log to go, syslog or a file of your liking with
ini_set("error_log", "syslog"); // or ini_set("error_log", "/path/to/syslog/file");