如何在Laravel 5.3上检查调试模式

问题描述 投票:2回答:3

我想在localhost中工作时看到错误。

应用程序\例外\ handler.php

我试过了:

public function render($request, Exception $exception)
{
    if ($this->isHttpException($exception) && env('APP_DEBUG') === false) {
        return response()->view('errors.404', [], 404);
    } else {
        return parent::render($request, $exception);
    }
}

要么;

if ($this->isHttpException($exception) && App::environment('APP_DEBUG') === false)

我尝试了如上所述,但它不起作用。

谢谢。


APP_DEBUG在.env中设置为true

php laravel laravel-5.3
3个回答
4
投票

为了避免缓存出现大问题,正确的检查方法是:

config('app.debug') == false


2
投票

试着改变

env('APP_DEBUG') === false

env('APP_DEBUG') == false

0
投票

在.env文件中,您应该:

APP_DEBUG=true
© www.soinside.com 2019 - 2024. All rights reserved.