我正在尝试使用aws-php-sdk将文件上传到aws,但出现此错误 消息:在us-east-2区域找不到s3服务的终结点
我在下面的配置文件中放置了正确的区域,
include("./vendor/autoload.php");
use Aws\S3\S3Client;
class Aws3{
private $S3;
public function __construct(){
$this->S3 = S3Client::factory([
'endpoint' => 'https://s3.us-east-2.amazonaws.com',
'key' => 'AKIAIOWQWV63UCD6MJ2Q',
'secret' => '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',
'region' => 'us-east-2'
]);
}
public function addBucket($bucketName){
$result = $this->S3->createBucket(array(
'Bucket'=>$bucketName,
'LocationConstraint'=> 'us-west-1'));
return $result;
}
public function sendFile($bucketName, $filename){
$result = $this->S3->putObject(array(
'Bucket' => $bucketName,
'Key' => $filename['name'],
'SourceFile' => $filename['tmp_name'],
'ContentType' => 'image/png',
'StorageClass' => 'STANDARD',
'ACL' => 'public-read'
));
return $result['ObjectURL']."\n";
}
}
任何解决方案?