Amazon web services 无法从响应中获取ETag值

Amazon web services 无法从响应中获取ETag值,amazon-web-services,amazon-s3,amazon-cloudfront,Amazon Web Services,Amazon S3,Amazon Cloudfront,代码: 答复: $response = $s3->copyObject(array( 'Bucket' => $bucket, 'Key' => $key, )); 我想在下面的代码中得到ETag值 Aws\Result Object ( [data:Aws\Result:private] => Array ( [CopyObjectResult] => Array

代码:

答复:

$response = $s3->copyObject(array(
     'Bucket' => $bucket,
     'Key' => $key,      
)); 
我想在下面的代码中得到ETag值

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
值为空。请帮助我,让我知道我将如何得到它


注意:当我们将aws v2从aws v2迁移到v3时,它在aws v2上运行良好。我们得到了不同类型的响应。

最后检查后,我只调用以下内容:

$etag = $response->get('ETag');
正如预期的那样,它工作得很好

$etag = $response['CopyObjectResult']['ETag'];