Php 使用错误报告禁用报告所有错误
可以使用吗Php 使用错误报告禁用报告所有错误,php,debugging,error-handling,Php,Debugging,Error Handling,可以使用吗 error_reporting(0); 要禁用任何类型的错误报告(用于生产)?绝对有效:请参阅下面的错误报告列表: <?php // Turn off all error reporting error_reporting(0); // Report simple running errors error_reporting(E_ERROR | E_WARNING | E_PARSE); // Reporting E_NOTICE can be good too (to
error_reporting(0);
要禁用任何类型的错误报告(用于生产)?绝对有效:请参阅下面的错误报告列表:
<?php
// Turn off all error reporting
error_reporting(0);
// Report simple running errors
error_reporting(E_ERROR | E_WARNING | E_PARSE);
// Reporting E_NOTICE can be good too (to report uninitialized
// variables or catch variable name misspellings ...)
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
// Report all errors except E_NOTICE
// This is the default value set in php.ini
error_reporting(E_ALL ^ E_NOTICE);
// Report all PHP errors (see changelog)
error_reporting(E_ALL);
// Report all PHP errors
error_reporting(-1);
// Same as error_reporting(E_ALL);
ini_set('error_reporting', E_ALL);
?>
您应该有错误报告,以便调试生产服务器上的任何问题 要防止用户看到错误,只需禁用错误显示:
ini_set("display_errors", 0);
我想知道为什么Laravel框架使用
错误报告(-1)来“关闭PHP的错误报告”代码>原因在定义上方的注释中说明:框架处理它。