类 'Guzzle\Http\Client' 未找到。

7
我正在尝试跟进Sitepoint上的教程http://www.sitepoint.com/guzzle-php-http-client/,我按照这里http://docs.guzzlephp.org/en/latest/overview.html#installation的步骤进行安装,并尝试运行第一个简单示例,但是它给了我问题。我还检查了我的PHP版本要求(5.5):我的是5.6,所以没问题。
我正在使用MAC,以下是我的代码。
error_reporting(E_ALL);
ini_set('display_errors', 1);

require_once 'vendor/autoload.php';

use Guzzle\Http\Client;
use Guzzle\Http\EntityBody;
use Guzzle\Http\Message\Request;
use Guzzle\Http\Message\Response;

$client = new Client("https://qrng.anu.edu.au");

$request = $client->get('/API/jsonI.php?length=10&type=uint8');

$response = $request->send();

echo $body = $response->getBody(true);

请问,我错过了什么?
1个回答

9

It is,

use GuzzleHttp\Client;

看起来你正在跟随基于 Guzzle 3.7 的教程,并且你已经安装了 Guzzle 6

了解更多。


谢谢!我应该额外检查文件夹名称。 - Tosin Onikute

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接