问题描述
我正在尝试在站点 http://www上继续学习本教程.sitepoint.com/guzzle-php-http-client/,我在这里 http://docs.guzzlephp.org/en/latest/overview.html#installation ,我正在尝试运行第一个简单示例,但这给了我麻烦.我还检查了我的PHP版本要求(5.5):我的是5.6,所以没关系.
I am trying to follow up on this tutorial on sitepoint http://www.sitepoint.com/guzzle-php-http-client/ , I followed the installation step by step here http://docs.guzzlephp.org/en/latest/overview.html#installation and I'm trying to run the first simple example, but its giving me issue. I also checked my PHP version requirements(5.5): Mine is 5.6, so thats Ok.
我正在使用MAC,请参见下面的代码.
I am using a MAC, See my code below.
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);
请,我错过了什么?
推荐答案
是
use GuzzleHttp\Client;
您的以下教程似乎基于 Guzzle 3.7
,并且您已经安装了 Guzzle 6
.
It seems your following tutorial which is based on Guzzle 3.7
and You have installed Guzzle 6
.
这篇关于找不到类'Guzzle \ Http \ Client'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!