By default, CodeIgniter displays all PHP errors. But when your development program ends, you may want to change this situation.
You will find this function error_reporting () at the top of the index. php file, through which you can set errors. Even if you disable the Error Report, the error record will not stop when an error occurs.
Therefore, modifying php. ini cannot achieve the desired effect.
The solution is as follows:
1. disable A Database Error Occurred Error prompt in Codeigniter
As mentioned in the CodeIgniter User Guide, setting the ENVIRONMENT constant to 'development' will allow all PHP error reports to be output to the browser. Conversely, setting the constant 'production 'will disable the output of all error reports.
Modify error_reporting in index. php:
Copy codeThe Code is as follows:
Define ('Environment ', 'production'); // The default value is development.
If (defined ('enable '))
{
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. disable a php Error was encountered Error prompt in Codeigniter
Modify database settings in config/database. php:
Copy codeThe Code is as follows:
$ Db ['default'] ['db _ debug'] = FALSE;