AWS-SDK:执行 GetObject() 得到一个空流
AWS-SDK: Executing GetObject() gets an Empty Stream
我的主要objective是获取特定对象的信息。
$client = $adapter->getClient();
$objectInfo = $client->getObject(
[
'Bucket' => 'bucket-name',
'Key' => "key-name",
]
);
dd($objectInfo->toArray()["Body"]);
当运行时,我得到的结果是:
GuzzleHttp\Psr7\Stream {
-stream: stream resource {
wrapper_type: "PHP"
stream_type: "TEMP"
mode: "w+b"
unread_bytes: 0
seekable: true
uri: "php://temp"
options: []
}
-size: null
-seekable: true
-readable: true
-writable: true
-uri: "php://temp"
-customMetadata: []
}
如有解决办法,将不胜感激。
我认为您应该尝试从对象调用 getContents() 方法。有关更多输入,请参阅以下页面
https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/s3-stream-wrapper.html
https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Psr7.Stream.html#_getContents
$objectInfo['Body']->getContents();
我的主要objective是获取特定对象的信息。
$client = $adapter->getClient();
$objectInfo = $client->getObject(
[
'Bucket' => 'bucket-name',
'Key' => "key-name",
]
);
dd($objectInfo->toArray()["Body"]);
当运行时,我得到的结果是:
GuzzleHttp\Psr7\Stream {
-stream: stream resource {
wrapper_type: "PHP"
stream_type: "TEMP"
mode: "w+b"
unread_bytes: 0
seekable: true
uri: "php://temp"
options: []
}
-size: null
-seekable: true
-readable: true
-writable: true
-uri: "php://temp"
-customMetadata: []
}
如有解决办法,将不胜感激。
我认为您应该尝试从对象调用 getContents() 方法。有关更多输入,请参阅以下页面 https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/s3-stream-wrapper.html
https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Psr7.Stream.html#_getContents
$objectInfo['Body']->getContents();