When CI is not used, we can use codes such as error_reporting(E_ALL); error_reporting(0); to control the error level. Of course, you can also use these statements in classes, but CI itself already has a mechanism to control the error level.
Maybe you don’t open index.php often, but the modifications are 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 level of error reporting. There are three default options, development testing and production, which are controlled by the switch statement above. The code is already clear and can be changed accordingly to suit your needs.