By default, CodeIgniter will display all PHP errors. But at the end of your development process, 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 turn off error reporting, error logging will not stop when an error occurs.
So, modifying php.ini cannot achieve the effect we want.
Here’s the solution:
1. A Database Error Occurred error prompt is prohibited in Codeigniter
As stated in the CodeIgniter User Guide, setting the ENVIRONMENT constant to the 'development' value will allow all PHP error reports to be output to the browser. Conversely, setting the constant to 'production' will suppress the output of all error reports.
Modify error_reporting in index.php:
Copy the code The code is as follows:
define( 'ENVIRONMENT', 'production'); //The 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. A PHP Error was encountered error is prohibited in Codeigniter Tips
Modify the database settings in config/database.php:
Copy the code The code is as follows:
$db['default ']['db_debug'] = FALSE;
http://www.bkjia.com/PHPjc/788625.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/788625.htmlTechArticleBy default, CodeIgniter will display all PHP errors. But at the end of your development process, you may want to change this situation. You will find this at the top of the index.php file...