我一直在查阅AWS SDK PHP的所有文档,但是我没有找到检索对象元数据的方法。我可以检索key、大小、最后修改时间等信息;但是文档中没有示例展示如何获取元数据。
我一直在查阅AWS SDK PHP的所有文档,但是我没有找到检索对象元数据的方法。我可以检索key、大小、最后修改时间等信息;但是文档中没有示例展示如何获取元数据。
headObject
。根据文档:HEAD操作从对象中检索元数据,而不返回对象本身。如果您只对对象的元数据感兴趣,则此操作很有用。要使用HEAD,您必须具有对象的读取访问权限。
以下是版本3 SDK的示例调用(这篇文章太老了,我认为现在应该使用版本3而不是版本2,但两个SDK都包含此调用)。$result = $client->headObject([
'Bucket' => '<string>', // REQUIRED
'IfMatch' => '<string>',
'IfModifiedSince' => <integer || string || DateTime>,
'IfNoneMatch' => '<string>',
'IfUnmodifiedSince' => <integer || string || DateTime>,
'Key' => '<string>', // REQUIRED
'Range' => '<string>',
'RequestPayer' => 'requester',
'SSECustomerAlgorithm' => '<string>',
'SSECustomerKey' => '<string>',
'SSECustomerKeyMD5' => '<string>',
'VersionId' => '<string>',
]);