ini_set('display_errors', 1);
2.設定index.phpdefine('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':
/* Report all errors */
error_reporting(E_ALL);
/* Display errors in output */
ini_set('display_errors', 1);
break;
case 'testing':
case 'production':
/* Report all errors except E_NOTICE */
/* This is the default value set in php.ini */
error_reporting(E_ALL ^ E_NOTICE);
/* Don't display errors (they can still be logged) */
ini_set('display_errors', 0);
break;
default:
exit('The application environment is not set correctly.');
}
}
參考資料http://php.net/manual/en/errorfunc.configuration.php#ini.display-errors
沒有留言:
張貼留言