【发布时间】:2018-06-08 23:21:28
【问题描述】:
我正在使用 Guzzle 6.3。我正在尝试发布带有标题的数据。 这是我的代码:
$headers = [
'content-type' => 'application/json',
'Accept' => 'application/json'
];
$request = new Psr7\Request('post', 'product', $headers, json_encode($data));
$res = $this->http->send($request);
$resData = json_decode($res->getBody(), true);
响应正文 ($resData) 始终等于发布的正文 ($data)。
谢谢。
【问题讨论】: