【发布时间】:2019-10-17 06:04:34
【问题描述】:
我需要在Exception/Handler.php 中获取.env 文件中的常量,
我已经更改了我的 Handle.php
public function render($request, Exception $exception)
{
if (env('APP_DEBUG')) {
return parent::render($request, $exception);
} else {
return response(view('error_custom')->render(),200);
}
}
和 env('APP_DEBUG') 返回 null,有什么想法吗?
【问题讨论】:
-
应该可以的。但是,建议使用
config值,因为它们会被缓存。config('app.debug') -
你使用的是哪个 laravel 版本?那应该可以正常工作。
标签: php laravel null environment-variables