0
我正在做一个狂饮的请求,让我以下回应:无法访问狂饮请求属性 - Laravel
{
"success": false,
"errors": {
"customer_id": "Crédit insuffisant sur le compte client"
}
$请求的print_r:
GuzzleHttp\Psr7\Response Object ([reasonPhrase:GuzzleHttp\Psr7\Response:private] => OK [statusCode:GuzzleHttp\Psr7\Response:private] => 200 [headers:GuzzleHttp\Psr7\Response:private] => Array ([Date] => Array ([0] => Thu, 02 Mar 2017 22:02:02 GMT) [Content-Type] => Array ([0] => application/json) [Content-Length] => Array ([0] => 89) [Connection] => Array ([0] => keep-alive) [Server] => Array ([0] => Apache/2.4.18 (Ubuntu)) [Set-Cookie] => Array ([0] => PHPSESSID=qhtpgvd5mhqg1a7gctpagvhap2; path=/) [Expires] => Array ([0] => Thu, 19 Nov 1981 08:52:00 GMT) [Cache-Control] => Array ([0] => no-store, no-cache, must-revalidate) [Pragma] => Array ([0] => no-cache)) [headerNames:GuzzleHttp\Psr7\Response:private] => Array ([date] => Date [content-type] => Content-Type [content-length] => Content-Length [connection] => Connection [server] => Server [set-cookie] => Set-Cookie [expires] => Expires [cache-control] => Cache-Control [pragma] => Pragma) [protocol:GuzzleHttp\Psr7\Response:private] => 1.1 [stream:GuzzleHttp\Psr7\Response:private] => GuzzleHttp\Psr7\Stream Object ([stream:GuzzleHttp\Psr7\Stream:private] => Resource id #339 [size:GuzzleHttp\Psr7\Stream:private] => [seekable:GuzzleHttp\Psr7\Stream:private] => 1 [readable:GuzzleHttp\Psr7\Stream:private] => 1 [writable:GuzzleHttp\Psr7\Stream:private] => 1 [uri:GuzzleHttp\Psr7\Stream:private] => php://temp [customMetadata:GuzzleHttp\Psr7\Stream:private] => Array ()))
我希望能够访问 “成功”,但...
,如果我做json_decode($请求 - > getBody()):
The Response content must be a string or object implementing __toString(), "object" given.
如果我做$请求 - >成功:
Undefined property: GuzzleHttp\Psr7\Response::$success
尝试'json_decode($请求 - > getBody() - > getContents()) - > success' –