【问题标题】:How to switch on debug mode in CakePHP 3?如何在 CakePHP 3 中打开调试模式?
【发布时间】:2018-01-11 18:46:15
【问题描述】:

我在 app.php 中将 $debug 设置为 true,但没有任何变化。

如何在 CakePHP 中启用调试模式?

【问题讨论】:

标签: cakephp cakephp-3.0


【解决方案1】:

根据cookbook,您可以通过更改config/app.php文件中“debug”参数的值来启用或禁用调试模式。

/**
 * Debug Level:
 *
 * Production Mode:
 * false: No error messages, errors, or warnings shown.
 *
 * Development Mode:
 * true: Errors and warnings shown.
 */
'debug' => filter_var(env('DEBUG', true), FILTER_VALIDATE_BOOLEAN),

在您的控制器中,您可以使用log() method 进行日志记录(适用于所有对象):

$this->log('debug message','debug');

【讨论】:

  • 并查看 logs/debug.log 以查看“调试消息”
【解决方案2】:

app_local.php 覆盖 app.php。在那里寻找'DEBUG', true

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多