0

次のようなコードがあります。

$result = $client->getObject(array(
   'Bucket' => $bucket,
   'Key'    => 'data.txt',
   'SaveAs' => '/tmp/data.txt'
));

ここにリストされている例の 1 つ: http://docs.aws.amazon.com/aws-sdk-php-2/latest/class-Aws.S3.S3Client.html#_getObject

残念ながら、次の致命的なエラーが発生します。

PHP Warning:  Missing argument 2 for AmazonS3::get_object() in /var/www/CronJobs/aws-sdk-    for-php/services/s3.class.php on line 1489
PHP Notice:  Undefined variable: filename in /var/www/CronJobs/aws-sdk-for-php/services/s3.class.php on line 1495
PHP Warning:  preg_match() expects parameter 2 to be string, array given in /var/www/CronJobs/aws-sdk-for-php/services/s3.class.php on line 1042
PHP Warning:  preg_match() expects parameter 2 to be string, array given in /var/www/CronJobs/aws-sdk-for-php/services/s3.class.php on line 1043
PHP Notice:  Array to string conversion in /var/www/CronJobs/aws-sdk-for-php/services/s3.class.php on line 548
PHP Fatal error:  Uncaught exception 'S3_Exception' with message 'S3 does not support "Array" as a valid bucket name. Review "Bucket Restrictions and Limitations" in the S3 Developer Guide for more information.' in /var/www/CronJobs/aws-sdk-for-php/services/s3.class.php:548
Stack trace:
0 /var/www/CronJobs/aws-sdk-for-php/services/s3.class.php(1530): AmazonS3->authenticate(Array, Array)
1 [internal function]: AmazonS3->get_object(Array)
2 /var/www/CronJobs/aws-sdk-for-php/sdk.class.php(436): call_user_func_array(Array, Array)
3 /var/www/CronJobs/leefomatic/index.php(70): CFRuntime->__call('getObject', Array)
4 /var/www/CronJobs/leefomatic/index.php(70): AmazonS3->getObject(Array)
5 {main}
thrown in /var/www/CronJobs/aws-sdk-for-php/services/s3.class.php on line 548

私のスクリプトでは、現在listObject、copy_object、およびdelete_optionで問題ありません。getObject で致命的なエラーが発生する理由について何か考えはありますか?

ありがとう。

4

1 に答える 1