我总是在配置文件中使用以下内容:
// Toggle this to change the settingdefine('DEBUG', true);// You want all errors to be triggerederror_reporting(E_ALL);if(DEBUG == true){ // You're developing, so you want all errors to be shown display_errors(true); // Logging is usually overkill during development log_errors(false);}else{ // You don't want to display errors on a production environment display_errors(false); // You definitely want to log any occurring log_errors(true);}这样可以轻松在调试设置之间切换。您可以通过检查代码在哪台服务器上运行(开发,测试,验收和生产)并相应地更改设置来进一步改善。
请注意,如果将error_reporting设置为0,则不会记录任何错误,正如Korri巧妙地指出的那样。



