Guzzle 6: no more json() method for responses

前端 未结 6 1522
悲哀的现实
悲哀的现实 2020-12-02 08:17

Previously in Guzzle 5.3:

$response = $client->get(\'http://httpbin.org/get\');
$array = $response->json(); // Yoohoo
var_dump($array[0][\'origin\']);
         


        
6条回答
  •  Happy的楠姐
    2020-12-02 08:43

    I use json_decode($response->getBody()) now instead of $response->json().

    I suspect this might be a casualty of PSR-7 compliance.

提交回复
热议问题