Laravel Class 'App\\Http\\Controllers\\GuzzleHttp\\Client' not found

时光总嘲笑我的痴心妄想 提交于 2019-12-04 12:37:05

You're going to want to get acquainted with PHP namespaces.

Most files in Laravel are namespaced. Calls to functions within a namespace start within that namespace, with two exceptions:

If you start the class name with a \, that tells PHP to start at the root-level namespace:

$client = new \GuzzleHttp\Client(); 

Or, you can put:

use GuzzleHttp\Client;

at the top of the file (you'll see a lot of these already throughout Laravel's default files) and then do

$client = new Client();
Titox d boss

You might have not installed guzzle.

Run composer require guzzlehttp/guzzle to install it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!