未找到 Laravel 类“AppHttpControllersGuzzleHttpClient"
问题描述
我已经安装了客户端并使用 composer dump autoload 进行了更新,但我仍然遇到同样的错误.通过 composer 安装后在项目目录下需要 guzzlehttp/guzzle:~6.0.
I've installed the client and I did an update using composer dump autoload but I still end up with the same error. After installing via composer require guzzlehttp/guzzle:~6.0 in the projects directory.
为什么它不起作用,为什么它甚至引用了错误的目录?
Why isn' it working and why is it even referencing the wrong directory?
推荐答案
你会想要熟悉 PHP 命名空间.
You're going to want to get acquainted with PHP namespaces.
Laravel 中的大多数文件都是命名空间的.对命名空间内的函数的调用始于该命名空间内,但有两个例外:
Most files in Laravel are namespaced. Calls to functions within a namespace start within that namespace, with two exceptions:
如果你用 开始类名,这告诉 PHP 从根级命名空间开始:
If you start the class name with a , that tells PHP to start at the root-level namespace:
或者,你可以说:
在文件的顶部(你会在 Laravel 的默认文件中看到很多 文件)然后执行
at the top of the file (you'll see a lot of these already throughout Laravel's default files) and then do
这篇关于未找到 Laravel 类“AppHttpControllersGuzzleHttpClient"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!