我已经在网上搜索了两天以上,可能已经浏览了大多数在线记录的场景和解决方法,但到目前为止我没有任何作用.
我在运行PHP 5.3的AWS SDK for PHP V2.8.7上.我正在尝试使用以下代码连接到我的S3存储桶:
// Create a `Aws` object using a configuration file
$aws = Aws::factory('config.php');
// Get the client from the service locator by namespace
$s3Client = $aws->get('s3');
$bucket = "xxx";
$keyname = "xxx";
try {
$result = $s3Client->putObject(array(
'Bucket' => $bucket,
'Key' => $keyname,
'Body' => 'Hello World!'
));
$file_error = false;
} catch (Exception $e) {
$file_error = true;
echo $e->getMessage();
die();
}
//
Run Code Online (Sandbox Code Playgroud)
我的config.php文件如下:
<?php
return array(
// Bootstrap the configuration file with …Run Code Online (Sandbox Code Playgroud)