首页 > 解决方案 > URI 必须是字符串或 UriInterface

问题描述

private function setRequest()
{
    $vKey = $this->voltKey;
    $vId= $this->voltId;

    $this->client = new Client(
        [
            'base_uri' => $this->url,
            'headers' => [
                'vkey' => $vKey ,
                'vid' => $vId,
                'Content-Type'  => 'application/json',
                'Accept'        => 'application/json',
            ]

        ]
    );
}

  private function setApiResponse($body = [])
{ 
    
    $this->response  = $this->client->request('put', 
        $this->url, ["body" => json_encode($body)]            
    );
    
        return $this;
}

请从 guzzle 遇到服务器错误.. 请问这有什么问题吗

'Accept'        => 'application/json',

因为堆栈跟踪指向该行

标签: laravelguzzle

解决方案


推荐阅读