By default, CodeIgniter will display all of the PHP errors. But you might want to change the situation when you end up with a development program.
You will find this function error_reporting () at the top of the index.php file, which allows you to set the error. Even if you close the error report, the error record will not stop when there is an error.
Therefore, the modification php.ini can not achieve the effect we want.
Here is the solution:
1. CodeIgniter prohibit a Database error occurred error hint
As the CodeIgniter user's guide says, setting the environment constant to ' development ' will allow all PHP error reports to be exported to the browser. Conversely, setting the constant to ' production ' will prevent all error report output.
Modify error_reporting in index.php:
Copy Code code as follows:
Define (' environment ', ' production '); Default is Development
if (defined (' Environment '))
{
Switch (Environment)
{
Case ' development ':
Error_reporting (E_all);
Break
Case ' testing ':
Case ' production ':
error_reporting (0);
Break
Default
Exit (' The application environment is not set correctly. ');
}
}
2. CodeIgniter prohibit a PHP error was encountered error hint
Modify database settings in config/database.php:
Copy Code code as follows:
$db [' Default '] [' db_debug '] = FALSE;