guzzle post 提交数据为空 使用PHP的http请求客户端guzzle如何添加请求头
$client = new \GuzzleHttp\Client(['http_errors' => false]);
//options json body headers 都是键值
$response = $client->request(
'POST',
$url,
['headers'=>$headers,'body'=>$entity]
);
数据返回为空
接口方面应该是要求是json 模式
所以是
try {
$response = $client->request(
'POST',
$url,
['headers' => $headers, 'json'=>['pageSize'=>20,'page'=>1]]
);
} catch (GuzzleException $e) {
echo $e->getMessage();
}
成功返回数据