我使用的是带有Laravel 5.2的Guize6。
我正在尝试访问一个简单的内部API:
use GuzzleHttp\Client;
$client = new Client(['base_uri' => getenv('URL_BASE').'api/v1/']);
$response = $client->request('GET', 'tournaments');我得到了这样的信息:
Fatal error: Call to undefined method GuzzleHttp\Client::request()当我看到docs时,它会说:
$client = new GuzzleHttp\Client(['base_uri' => 'https://foo.com/api/']);但PHPStorm无法解析GuzzleHttp
我该怎么做才能让它工作?
发布于 2016-02-06 13:19:51
我也在使用guzzle,它对我很有效,试试这样
use GuzzleHttp;
use GuzzleHttp\Subscriber\Oauth\Oauth1;
$client = new GuzzleHttp\Client();要获得响应,请尝试以下命令
$response = $client->request('GET', 'tournaments',['query' => ['base_uri' => getenv('URL_BASE').'api/v1/']]);如果不起作用,也可以试试这个。
$response = $client->request('GET', getenv('URL_BASE').'api/v1/tournaments');https://stackoverflow.com/questions/35236073
复制相似问题