【问题标题】:Removing laravel 4.1 error messages in production site删除生产站点中的 laravel 4.1 错误消息
【发布时间】:2014-01-27 21:06:41
【问题描述】:

我想知道我是否能够关闭 laravel 4.1 中的错误消息。

我有一个项目,它有 3 个环境:生产、测试​​和开发。是否可以关闭生产中的错误消息?

【问题讨论】:

    标签: php laravel laravel-4 error-handling


    【解决方案1】:

    为了不让您的用户看到错误消息,您必须:

    1) 打开你的app/config/app.php 并设置

    'debug' => false
    

    2) 打开你的app/start/global.php 并编辑:

    App::error(function(Exception $exception, $code)
    {
        Log::error($exception);
    
        return "whatever you need here!"; // <---- add a return command
    });
    

    3) 这个返回行可能是这样的:

    return Redirect::route('userErrorMessageRouteName');
    

    return View::make('userErrorMessageView');
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-08-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-24
      • 2021-04-14
      • 2020-07-07
      • 2021-01-28
      相关资源
      最近更新 更多