类'App\Controller\Debugger'没有找到与cakephp ver3的错误 [英] Class 'App\Controller\Debugger' not found error with cakephp ver3

查看:176
本文介绍了类'App\Controller\Debugger'没有找到与cakephp ver3的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用cakephp 3.0.2。我试图使用 Debugger :: dump($ date_taken_year); 并遇到错误错误:类'App\Controller\Debugger'未找到。如果我删除使用 Debugger :: dump()的行,错误消失,控制器功能运行顺利。

I am using cakephp 3.0.2. I tried to use Debugger::dump($date_taken_year); and encountered the error Error: Class 'App\Controller\Debugger' not found. If I remove the line that uses Debugger::dump(), the error disappears and the controller function runs smoothly.

我已经检查了在app.php里面,我有这行'debug'=> true,。我必须做任何其他使用Debugger类吗?我使用cakephp ver2.x时没有问题

I have checked that inside app.php, I have this line 'debug' => true,. Do I have to do anything else to use Debugger class? I had no problems when using cakephp ver2.x

推荐答案

看来,你只是忘了导入命名空间, / p>

It seems, you only forgot to import namespace, proper use would be

use Cake\Error\Debugger;
// ...
Debugger::dump($date_taken_year);

这篇关于类'App\Controller\Debugger'没有找到与cakephp ver3的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆