我通过编辑器安装了SDK,并以.aws /凭证获得了我的信用。当运行' php PutObject.php'我没有输出也没有错误/异常但是也没有上传对象。我正在运行Ubuntu 16.04。奇怪的是,我在Mac上安装了完全相同的配置,我可以放置对象。
<?php
require 'vendor/autoload.php';
use Aws\S3\S3Client;
use Aws\Exception\AwsException;
// Create an S3 client
$client = new Aws\S3\S3Client([
'region' => 'us-east-1',
'version' => 'latest',
'debug' => true
]);
// Where the files will be source from
$source = 'TestUnit';
// Where the files will be transferred to
$dest = 's3://mybucket/TestUnit';
// Create a transfer object.
$manager = new \Aws\S3\Transfer($client, $source, $dest);
// Perform the transfer synchronously.
$manager->transfer();