我最近将我的 guzzle 版本从 3 更新到 6。以下调用在 3 上工作,但现在我需要将其升级到 6(因为它不工作)。阅读文档后,我有点困惑这个新的帖子请求在 Guzzle 6 中是如何工作的。这是我在 Guzzle 3 中的旧帖子请求
try
{
$request = $this->guzzleClient->post(
'/login?token='.$this->container->getParameter("token"),
array(),
json_encode($data)
);
$request->setHeader('Content-Type', 'application/json');
$response = $request->send();
return $response->json();
}
我如何翻译它以便发布请求?
一只萌萌小番薯