Xampp で Amazon Aws Php SDK をセットアップしようとしています。
SDK をインストールした後、次のコードを使用して Amazon S3 からバケットをダウンロードしようとしています。
<?php
error_reporting(-1);
ini_set('display_errors', 'on');
include_once ('aws/aws-autoloader.php');
use Aws\S3\S3Client;
$client = S3Client::factory(array(
'key' => '__my__key__',
'secret' => '__secret__key__'
));
$destination = 'downloaded_bucket';
$source_bucket = '__my__bucket__name';
$key_prefix = '';
$options = array('debug'=>true);
$client -> downloadBucket($destination,$source_bucket,$key_prefix,$options);
?>
ブラウザからこのphpを実行すると、次のエラーが発生します。
Notice: Use of undefined constant STDOUT - assumed 'STDOUT' in __my__path\Aws\S3\Sync\AbstractSyncBuilder.php on line 294
STDOUT
Warning: fwrite() expects parameter 1 to be resource, string given in __my__path\Aws\S3\Sync\DownloadSyncBuilder.php on line 124
STDOUT
Warning: fwrite() expects parameter 1 to be resource, string given in __my__path\Aws\S3\Sync\DownloadSyncBuilder.php on line 124
STDOUT
Warning: fwrite() expects parameter 1 to be resource, string given in __my__path\Aws\S3\Sync\DownloadSyncBuilder.php on line 124
リソースの代わりに文字列 'STDOUT' が渡されるため、最初の通知が原因で最後の 3 つの警告が発生します。
最初の通知の理由は何ですか?この通知のコード セグメントは次のとおりです。
if ($this->debug) {
$this->addDebugListener($sync, is_bool($this->debug) ? STDOUT : $this->debug);
}
これは SDK の一部です。そして、fwrite 警告コードの犯人は addDebugListener 関数です
protected function addDebugListener(AbstractSync $sync, $resource)
{
//blah blah
fwrite($resource, "Downloading {$from} -> {$to}\n");
//blah blah
}
私のPHPバージョンは5.4.16です