单纯纪录自己用的 Guzzle Request 模板
use GuzzleHttp\Client;
$client = new GuzzleHttp\Client(['base_uri' => 'https://api.example/']);
$token = '<TOKEN>';
$method = 'GET';
$url = 'v1.3/products';
$headers = ['Authorization' => 'Bearer ' . $token];//$headers must be an array
$response = $client->request($method, $url, [
'headers' => $headers
]);
dd(json_decode($response->getBody(),true));
use GuzzleHttp\Client as Client;
use GuzzleHttp\Psr7\Request as Request;
use GuzzleHttp\Exception\ClientException as ClientException;
$client = new Client(['base_uri' => 'https://api.example/']);
$token = '<TOKEN>'
$method = 'POST';
$url = 'URL'
$header = ['Authorization'=>'Bearer '.$token, 'Content-Type'=>'application/json'];
$body = 'BODY';
$request = new Request($method, $url, $header, $body);
try{
$response = $client->send($request);
dd(json_decode($response->getBody(),true));
} catch (ClientException $e){
dd(json_decode($e->getResponse()->getBody(),true));
}
>>: 安全意识,培训和教育(security awareness, training and education)
记录学习内容。 以下内容和截图大多引用文章。 还不了解,内容可能有错误。 Queue 可以用 Sta...
话就不多说了,直接开始今天的内容吧 闭包 闭包的别称为「匿名函数」有三个特点 可以像函数一样被呼叫 ...
Aloha!又是我是少女人妻 Uerica!白天楼上常常会施工,钻地板跟敲打的声音总是让人难以忍受,...
话不多说,赶紧把我们的作品Demo 给我们 铁人学院的业主吧!! Demo 进入主画面 我们可以透过...
近朱者赤,近墨者黑 - KNN 今日学习目标 K-近邻演算法介绍 KNN 演算法解析 KNN 於分类...