Skip to content

Instantly share code, notes, and snippets.

@kamiazya
Created February 15, 2018 08:04
Show Gist options
  • Save kamiazya/3864a6ef218f9cf4f914bc1288a8a610 to your computer and use it in GitHub Desktop.
Save kamiazya/3864a6ef218f9cf4f914bc1288a8a610 to your computer and use it in GitHub Desktop.
CakePHP 2.x系でデバッグレベルを環境変数で操作する
<?php
/**
* CakePHP Debug Level:
*
* Production Mode:
* 0: No error messages, errors, or warnings shown. Flash messages redirect.
*
* Development Mode:
* 1: Errors and warnings shown, model caches refreshed, flash messages halted.
* 2: As in 1, but also with full debug messages and SQL output.
*
* In production mode, flash messages redirect after a time interval.
* In development mode, you need to click the flash message to continue.
*/
if (env('PROD') === '1') {
Configure::write('debug', 1);
} else {
Configure::write('debug', 2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment