CakePHP:未显示调试消息

vybvopom  于 2023-06-06  发布在  PHP
关注(0)|答案(1)|浏览(180)

我在config/app_local.php中有这样的代码:

return [
    /*
     * 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),
    'DebugKit' => [ 'forceEnable' => TRUE], 
...

在此之前,我在日志文件中有此警告:

warning: DebugKit is disabling itself as your host `my.example.com` is not in the known safe list of 
   top-level-domains (localhost, invalid, test, example, local). 
   If you would like to force DebugKit on use the `DebugKit.forceEnable` Configure option.

在我设置了上面的代码之后,警告已经消失了,但是当错误发生时,我仍然看不到CakePHP调试窗口。我只看到这个:

Fatal error: Declaration of App\Controller\ErrorController::beforeRender(Cake\Event\EventInterface $event) 
  must be compatible with App\Controller\AppController::beforeRender(Cake\Event\EventInterface $event): 
  void in /var/www/vhosts/example.ocm/my.example.com/src/Controller/ErrorController.php on line 54

我还错过了什么,做错了什么?调试消息仅在日志文件中,但我希望在浏览器中也能看到它。

mpgws1up

mpgws1up1#

如错误消息所示,两个函数的原型不匹配。AppController上的: void表示该函数不会返回任何内容。ErrorController缺少此内容。他们需要匹配。

相关问题