The 11 Most Common Constants in CodeIgniter

codeigniter constantsci environmentcodeigniter pathsci versionphp extensions
Published·Modified·
  1. ENVIRONMENT The product environment, which has three types: development, testing, and production.

  2. SELF The name of the CI entry file. For example, mine is index.php.

  3. BASEPATH The path to the main CI folder. The default is the path to the system folder. For example, mine is /home/work/www/CodeIgniter-3.0.0/system/.

  4. FCPATH The path where the main entry file (SELF) is located. For example, mine is /home/work/www/CodeIgniter-3.0.0/.

  5. SYSDIR The name of the main CI folder. The default is system.

  6. APPPATH The path to the main product folder. The default is the path to the application folder. For example, mine is /home/work/www/CodeIgniter-3.0.0/application/.

  7. VIEWPATH The path where template files are stored. The default is the path to the views folder. For example, mine is /home/work/www/CodeIgniter-3.0.0/application/views/.

  8. CI_VERSION The version number of CI.

  9. MB_ENABLED Whether the mbstring extension is loaded. Returns true if loaded, otherwise false.

  10. ICONV_ENABLED Whether the iconv extension is loaded. Returns true if loaded, otherwise false.

  11. UTF8_ENABLED Whether UTF-8 is available.

There are also some special global variables stored in APPPATH . 'config/constants.php'. Generally, the values within are not called or modified.