【发布时间】:2014-01-26 00:41:44
【问题描述】:
我有一个 S3 存储桶,其中包含 200 万个 MP3 文件,有时客户订购了一个 mp3 文件,但他们无法从我们的 S3 存储桶下载文件。在我去请求内容提供商重新交付文件之前,我想创建一个简单的脚本来检查文件是否存在于 S3 存储桶中。我写了一个脚本来检查存储桶,但我一直收到这个错误:
可捕获的致命错误:传递给 Guzzle\Service\Client::getCommand() 的参数 2 必须是一个数组,给定字符串,在 phar:///mnt/universal_portal/prod/download/aws.phar/vendor/ 中调用guzzle/guzzle/src/Guzzle/Service/Client.php 位于第 93 行,并在 phar:///mnt/universal_portal/prod/download/aws.phar/vendor/guzzle/guzzle/src/Guzzle/Service/Client 中定义。第113行的php
这是我写的代码
require_once('appsettings.php');
require 'aws.phar';
use Aws\S3\S3Client;
$client = S3Client::factory(array(
'key' => $aws_key,
'secret' => $aws_secret
));
$filename = '000002422704.mp3' . strtolower($aws_key);
$info = $client->if_object_exists($aws_bucket,$filename);
return $info;
我已经关闭了这个Amazon 链接,但我无法让这个文件检查工作。
非常感谢任何帮助。
干杯
【问题讨论】:
标签: php amazon-web-services amazon-s3 file-exists