检索S3对象用户元

编程入门 行业动态 更新时间:2024-10-22 14:26:08
本文介绍了检索S3对象用户元 - AWS SDK V3 PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在找检索对象的用户定义的元数据在我的S3存储桶,从PHP SDK。

根据编辑对象元数据,用户元数据存储的对象,并使用它返回,并开始与X-AMZ-元 -

我已通过如x-AMZ-元测试控制台定义的用户的元数据上的目的,在两个载时间和上传之后加入它(通过web控制台,不上载的API)。

测试元数据再也没有回来。我总是得到相同的系统元数据。也就是说,我只得到了以下键@metadata:

文件夹

状态code effectiveUri 头    的x AMZ-ID-2    的X AMZ-请求ID    日期    的X AMZ-桶区域    内容类型    传输编码    服务器

对象

键 上一次更改    日期    timezone_type    时区 ETag的 尺寸 StorageClass

然而,在其他语言中实现这一点,一个简单的方法调用参与。

获取Android SDK中用户元

获取的Java SDK 用户元

我如何去完成同样的任务在PHP SDK?

任何帮助将是很大的AP preciated:)

解决方案

我跟V3 AWS SDK的PHP有同样的问题。一些研究和测试后,我确定我可以使用 headObject :

< PHP     $标题= $ S3-> headObject(阵列(       斗=> $桶,       键=> $关键     ));     的print_r($包头中>的toArray()); ?>

示例输出与系统定义的元数据并删除其他识别信息:

阵列 ( / *删除* /     [元] =>排列         (             [订购日期] =>周一,2015年8月31日19时03分五十二秒+0000             [颜色] =>绿色             [水果] =>苹果             [参考价格] => 99.95         ) / *删除* /     [@metadata] =>排列         (             [状态code] => 200             [effectiveUri] => s3.amazonaws/REMOVED/REMOVED             [标题] =>排列                 (                     [X-AMZ-ID-2] => REMOVED                     [X-AMZ-请求ID] => REMOVED                     [日期] =>星期三,2015年9月2日4点43分02秒格林尼治标准​​时间                     [X-AMZ-元订购日期] =>周一,2015年8月31日19时03分五十二秒+0000                     [X-AMZ-元彩] =>绿色                     [X-AMZ-元水果] =>苹果                     [X-AMZ-元价格] => 99.95                     [上次修改] =>星期三,2015年9月2日4点11分13秒格林尼治标准​​时间                     [ETAG] => 去掉                     [X-AMZ-存储类] => REDUCED_REDUNDANCY                     [接受-范围] =>字节                     [内容类型] =>应用程序/八位字节流                     [内容长度=> 80771                     [服务器] => AmazonS3                 )         ) )

I'm looking to retrieve user-defined meta-data from objects in my S3 bucket, from the php sdk.

As per Editing Object Meta Data, User metadata is stored with the object and returned with it, and begin with "x-amz-meta-"

I have defined user metadata on objects through the console like "x-amz-meta-test", at both upload time, and adding it after the upload (through web console, not the upload API).

The test metadata is never returned. I always get the same system metadata. That is, I get only the following keys in @metadata:

Folder

statuscode effectiveUri headers x-amz-id-2 x-amz-request-id date x-amz-bucket-region content-type transfer-encoding server

Objects

Key LastModified date timezone_type timezone ETag Size StorageClass

However, to achieve this in other languages, a simple method call is involved.

Get User Metadata in Android SDK

Get User Metadata in Java SDK

How do I go about accomplishing the same task in the PHP SDK?

Any help would be greatly appreciated :)

解决方案

I had the same issue with v3 AWS SDK for PHP. After some research and testing, I determined I could use headObject:

<?php $headers = $s3->headObject(array( "Bucket" => $bucket, "Key" => $key )); print_r($headers->toArray()); ?>

Example output with System-Defined Metadata and other identifying information REMOVED:

Array ( /* REMOVED */ [Metadata] => Array ( [orderdate] => Mon, 31 Aug 2015 19:03:52 +0000 [color] => green [fruit] => apple [price] => 99.95 ) /* REMOVED */ [@metadata] => Array ( [statusCode] => 200 [effectiveUri] => s3.amazonaws/REMOVED/REMOVED [headers] => Array ( [x-amz-id-2] => REMOVED [x-amz-request-id] => REMOVED [date] => Wed, 02 Sep 2015 04:43:02 GMT [x-amz-meta-orderdate] => Mon, 31 Aug 2015 19:03:52 +0000 [x-amz-meta-color] => green [x-amz-meta-fruit] => apple [x-amz-meta-price] => 99.95 [last-modified] => Wed, 02 Sep 2015 04:11:13 GMT [etag] => "REMOVED" [x-amz-storage-class] => REDUCED_REDUNDANCY [accept-ranges] => bytes [content-type] => application/octet-stream [content-length] => 80771 [server] => AmazonS3 ) ) )

更多推荐

检索S3对象用户元

本文发布于:2023-10-04 09:12:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1467142.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:对象   用户

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!