如何获得特定的响应结果值

时间:2019-08-25 14:49:33

标签: php laravel response imgur

我正在尝试通过Laravel控制器使用Laravel将图像上传到Imgur,但是,我已经创建了上传,但是我不知道如何获取响应结果的特定ID。谢谢。

$client = new \GuzzleHttp\Client();
        $response = $client->request('POST', 'https://api.imgur.com/3/image', [
            'headers' => [
                'authorization' => 'Client-ID ' . 'my_id',
                'content-type' => 'application/x-www-form-urlencoded',
            ],
            'form_params' => [
                'image' => base64_encode(file_get_contents($request->file('image')->path()))
            ],
        ]);
        echo $result = response()->json(json_decode(($response->getBody()->getContents())));

the Value that I want to get

1 个答案:

答案 0 :(得分:1)

WriteResult可用于访问对象属性。签出以下示例:

->