When CI is not used, we can use error_reporting (E_ALL); error_reporting (0); such code to control the error reporting level. Of course, you can also use these statements in the class, but CI itself has a mechanism to control the error level.
You may not open index. php frequently, but the modification is in this file:
/* *--------------------------------------------------------------- * APPLICATION ENVIRONMENT *--------------------------------------------------------------- * * You can load different configurations depending on your * current environment. Setting the environment also influences * things like logging and error reporting. * * This can be set to anything, but default usage is: * * development * testing * production * * NOTE: If you change these, also change the error_reporting() code below * */define('ENVIRONMENT', 'development');/* *--------------------------------------------------------------- * ERROR REPORTING *--------------------------------------------------------------- * * Different environments will require different levels of error reporting. * By default development will show errors but testing and live will hide them. */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.');}}
ENVIRONMENT is used to control the error reporting level. By default, there are three options: development testing production, which are controlled by the preceding switch statement. The code is clear and can be changed as needed.