Call to undefined method DebugBar\\DebugBar::info()
使用 Laravel 的调试工具 laravel-debugbar 的 Facade 方式 Debugbar::info(), Debugbar::error()等方法打印日志消息,页面打不开,查看 PHP 错误日志报错:Call to undefined method DebugBar\\DebugBar::info().
请确保按照https://github.com/barryvdh/laravel-debugbar上的文档安装的,别忘了执行 composer dump-autoload.
如果你找不到原因,可能是命名空间引用错了,改成
use Barryvdh\Debugbar\Facade as Debugbar;
再用 Facade 的方式调用:
Debugbar::info('test debug info');
这个时候发现可以了,如图:
不过这样使用有点不方便了,这个组件的 Facade 的定义方式有点奇怪,不应该这样去定义,先就这样用吧,或者自己定义一个全局函数,直接通过 app(‘debugbar’) 这种方式去调用。吧。
您可能感兴趣的文章:
Call to undefined method DebugBar\\DebugBar::info()
Laravel 调试工具 laravel-debugbar 打印日志消息
Laravel调试利器Laravel Debugbar使用教程
解决Magento报错:Fatal error: Call to undefined method
Laravel 调试工具 laravel-debugbar使用介绍
Call to undefined function curl_init的解决办法
PHP spl_autoload_register 自动加载方法浅析
php Fatal error: Call to undefined function mb_convert_encoding()
jQuery ajax BUG:object doesn't support this property or method
Fatal error: Call to undefined function curl_init