How to adjust the error severity of CodeIgniter

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.