无法从响应中获取 ETag 值
Unable to get ETag value from the response
代码:
$response = $s3->copyObject(array(
'Bucket' => $bucket,
'Key' => $key,
));
回复:
Aws\Result Object
(
[data:Aws\Result:private] => Array
(
[CopyObjectResult] => Array
(
[ETag] => "s906113sa3401932f56f79ec75a1c877"
[LastModified] => Aws\Api\DateTimeResult Object
(
[date] => 2021-05-31 04:51:54.000000
[timezone_type] => 2
[timezone] => Z
)
)
[Expiration] =>
[CopySourceVersionId] =>
[VersionId] =>
[ServerSideEncryption] =>
[SSECustomerAlgorithm] =>
[SSECustomerKeyMD5] =>
[SSEKMSKeyId] =>
[SSEKMSEncryptionContext] =>
[BucketKeyEnabled] =>
[RequestCharged] =>
[@metadata] => Array
(
[statusCode] => 200
[effectiveUri] => https://bucket-dev.s3.amazonaws.com/store111/RawVideo/videogallery/file_example_MP4_480_1_5MG_1622436712.mp4
[headers] => Array
(
[x-amz-id-2] => DFzipf5adLLXV1435xCQO5d+R0LgDDl74o143UicbYF5biXv78G/j4HEDhoS8FsBY9C8HC+mOw8=
[x-amz-request-id] => 4SVDA143BSDZ49A6QJK
[date] => Mon, 31 May 2021 04:51:54 GMT
[content-type] => application/xml
[content-length] => 234
[server] => AmazonS3
)
[transferStats] => Array
(
[http] => Array
(
[0] => Array
(
)
)
)
)
[ObjectURL] => https://bucket-dev.s3.amazonaws.com/store111/RawVideo/videogallery/file_example_MP4_480_1_5MG_1622436712.mp4
)
[monitoringEvents:Aws\Result:private] => Array
(
)
)
上面我想在下面的代码中获取ETag值
$etag = $response->get('ETag');
我得到的 $etag
值为空。请帮忙告诉我如何获得它?
注意:当我们将 aws v2 从 aws v2 迁移到 v3 时,它在 aws v2 上运行良好,我们得到了不同类型的响应。
最后检查后,我只是调用下面:
$etag = $response['CopyObjectResult']['ETag'];
它按预期工作正常。
代码:
$response = $s3->copyObject(array(
'Bucket' => $bucket,
'Key' => $key,
));
回复:
Aws\Result Object
(
[data:Aws\Result:private] => Array
(
[CopyObjectResult] => Array
(
[ETag] => "s906113sa3401932f56f79ec75a1c877"
[LastModified] => Aws\Api\DateTimeResult Object
(
[date] => 2021-05-31 04:51:54.000000
[timezone_type] => 2
[timezone] => Z
)
)
[Expiration] =>
[CopySourceVersionId] =>
[VersionId] =>
[ServerSideEncryption] =>
[SSECustomerAlgorithm] =>
[SSECustomerKeyMD5] =>
[SSEKMSKeyId] =>
[SSEKMSEncryptionContext] =>
[BucketKeyEnabled] =>
[RequestCharged] =>
[@metadata] => Array
(
[statusCode] => 200
[effectiveUri] => https://bucket-dev.s3.amazonaws.com/store111/RawVideo/videogallery/file_example_MP4_480_1_5MG_1622436712.mp4
[headers] => Array
(
[x-amz-id-2] => DFzipf5adLLXV1435xCQO5d+R0LgDDl74o143UicbYF5biXv78G/j4HEDhoS8FsBY9C8HC+mOw8=
[x-amz-request-id] => 4SVDA143BSDZ49A6QJK
[date] => Mon, 31 May 2021 04:51:54 GMT
[content-type] => application/xml
[content-length] => 234
[server] => AmazonS3
)
[transferStats] => Array
(
[http] => Array
(
[0] => Array
(
)
)
)
)
[ObjectURL] => https://bucket-dev.s3.amazonaws.com/store111/RawVideo/videogallery/file_example_MP4_480_1_5MG_1622436712.mp4
)
[monitoringEvents:Aws\Result:private] => Array
(
)
)
上面我想在下面的代码中获取ETag值
$etag = $response->get('ETag');
我得到的 $etag
值为空。请帮忙告诉我如何获得它?
注意:当我们将 aws v2 从 aws v2 迁移到 v3 时,它在 aws v2 上运行良好,我们得到了不同类型的响应。
最后检查后,我只是调用下面:
$etag = $response['CopyObjectResult']['ETag'];
它按预期工作正常。