我尝试将图片上传到我创建的AWS s3存储桶,因此我复制了粘贴AWS文档中的标准代码以完成此操作,但我得到了一个绝对的空白页面。就像即使我发出一个回声' hi'在任何陈述之前,即使没有出现。想知道是否有人可以帮助阐明这个话题。
<?php
//this is the path to my S3 resource
use PHP\resources\aws\Aws\S3\S3Client;
$bucket = 'i put my bucket name here';
$keyname = 'yoyo';
// $filepath should be absolute path to a file on disk
$filepath = 'images/verified.png';
// Instantiate the client.
$s3 = S3Client::factory(array(
'profile' => 'default',
));
//the contents of my credentials.ini file are
//[default]
//aws_access_key_id = myaccessidhere
//aws_secret_access_key = mysecretkeyhere
// Upload a file.
$result = $s3->putObject(array(
'Bucket' => $bucket,
'Key' => $keyname,
'SourceFile' => $filepath,
'ACL' => 'public-read',
'StorageClass' => 'REDUCED_REDUNDANCY',
)
));
echo $result['ObjectURL'];
echo 'done';
?>
有谁知道为什么这段代码根本不起作用?我非常感谢任何提供的帮助,谢谢你!