简体   繁体   English

如何使用 PHP SDK v2 从 aws s3 headObject 读取结果?

[英]how to read results from aws s3 headObject using PHP SDK v2?

I am able to successfully get results back from a call to headObject like this.我能够像这样成功地从对 headObject 的调用中获得结果。 But then I can't access what's in $result as result is an object (Guzzle\Service|Resource\Model) and the data I see in it is obviously in protected variables meaning I have to use an object call to get it.但是我无法访问 $result 中的内容,因为结果是 object (Guzzle\Service|Resource\Model) 并且我在其中看到的数据显然是在受保护的变量中,这意味着我必须使用 object 调用来获取它。 But how do I know what the method call should be?但是我怎么知道方法调用应该是什么?

           $result = $client->headObject([
            'Bucket' => $bucket, // REQUIRED
            'Key' => $key // REQUIRED            
        ]);


        $relevantmetaData = array();
        $relevantmetaData['LastModified'] = $result->data['LastModified'];

The link here doesn't mention a method to get at $data 这里的链接没有提到获取 $data 的方法

I guess I should just have tried get(), it works.我想我应该尝试一下 get(),它有效。

$relevantmetaData['LastModified'] = $result->get('LastModified');

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用AWS开发工具包PHP v2 upload()的Amazon S3设置元数据失败 - Amazon S3 setting metadata fails using AWS SDK PHP v2 upload() 使用AWS PHP SDK v2在S3区域之间进行非阻塞对象复制 - Non blocking object copy between S3 regions with the AWS PHP SDK v2 如何使用 AWS SDK for PHP v3 Aws/ResultPaginator->Search 和 JMESPath 表达式按大小过滤 S3 对象? - How can I filter S3 objects by size using AWS SDK for PHP v3 Aws/ResultPaginator->Search and JMESPath expression? 使用S3进行身份验证来自服务器端时,如何从android(客户端)调用AWS S3图像URL(php + aws sdk php v3) - How to call AWS S3 image URL from android(Client) when the authentication with S3 is from server-side(php+ aws sdk php v3) 使用 PHP SDK 仅列出来自 AWS S3 的目录 - Listing only the directory from AWS S3 using PHP SDK 如何使用aws php sdk与Amazon S3同步文件夹? - How to sync a folder with Amazon S3 using aws php sdk? 如何使用PHP SDK v3从Amazon S3显示文本文件的内容 - How to display contents of text file from Amazon S3 using PHP SDK v3 我如何使用AWS凭证读取没有S3 SDK的S3文件? - How can i read an s3 file without S3 SDK using aws credentials? 如何将文件从 S3 存储桶复制到 PHP(AWS SDK for PHP)中的 S3 存储桶? - How to copy files from S3 bucket to S3 bucket in PHP (AWS SDK for PHP)? 使用 AWS PHP SDK [S3] 打印到 php 页面 - Printing out to a php page using AWS PHP SDK [S3]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM