Lumenはデフォルトで全てのエラーが出力されます。
本番環境では出力されるエラー内容を設定したいのですが、その場合は、
$ vim /PATH/TO/vendor/laravel/lumen-framework/src/Concerns/RegistersExceptionHandlers.phpを開き、
protected function registerErrorHandling()
{
error_reporting(-1);
set_error_handler(function ($level, $message, $file = '', $line = 0) {
if (error_reporting() & $level) {
throw new ErrorException($message, 0, $level, $file, $line);
}
});
set_exception_handler(function ($e) {
$this->handleUncaughtException($e);
});
register_shutdown_function(function () {
$this->handleShutdown();
});
}
にある、error_reporting(-1)を変更します。本番の場合は「何も出力しない or 重大なエラーだけ出力」、で良いと思うので、
// 何も表示しない error_reporting(0); // 重大な実行時エラーを出力 error_reporting(E_ERROR);になります。
以上でぇぇぇぇぇぇす!
0 件のコメント:
コメントを投稿