如何从控制器访问app/config/app.php中的调试变量以查看是否处于调试模式?

<?php                                                                                                                
                                                                                                                     |
  /*                                                                                                                 |        if ( $this->user->id )
  |--------------------------------------------------------------------------                                        |        {
  | Application Debug Mode                                                                                           |            // Save roles. Handles updating.
  |--------------------------------------------------------------------------                                        |            $this->user->saveRoles(Input::get( 'roles' ));
  |                                                                                                                  |
  | When your application is in debug mode, detailed error messages with                                             |            // Redirect to the new user page
  | stack traces will be shown on every error that occurs within your                                                |            return Redirect::to('admin/users/'.$this->user->id)->with('success', Lang::get('admin/users/messages.cre
  | application. If disabled, a simple generic error page is shown.                                                  |ate.success'));
  |                                                                                                                  |        }
  */                                                                                                                 |  else
                                                                                                                     |  {
  'debug' => true,    

推荐答案

You can use the helper function config (Laravel 5+).

$debug = config('app.debug');

Laravel 4.2:

$debug = Config::get('app.debug');

Laravel相关问答推荐

使用Laravel判断其他数据库中是否存在记录

如何仅将日期列解析为月和日?

语法错误或访问冲突:1115 未知字符集:utf8mb4

Laravel:使用 Input::old 时 textarea 不会重新填充

如何为路由 laravel 5 使用OR中间件

如何通过一个 laravel 安装处理子域

在 laravel 中动态更改时区

Laravel:转义LIKE子句?

会话中的 Laravel 存储数组

Laravel 干预图像 GD 库扩展

路由模型绑定不起作用

你如何在自定义 Laravel Nova 工具中使用确认对话?

在 Laravel 4 迁移中创建 MYSQL 过程

Laravel - 自定义时间戳列名称

如何在 Laravel 5.1 中为Electron邮件添加标题

Laravel Eloquent 模型中的字段

如何从 Laravel 中的资源中获取图像?

Laravel 接口

Laravel 中的 isDirty() 是什么意思?

为什么 phpunit 没有得到 phpunit.xml 中指定的正确 APP_ENV?