使用php在没有访问权限的情况下上传到Amazon S3&;密钥
使用PHP,我想上传一些文件到AmazonS3公共存储桶。但我不想在代码中使用访问密钥和密钥。因为当我搜索发现使用关键字“null”可以解决这个问题。在PHP中,我们使用“”作为null,但运气不好。下面是我的代码使用php在没有访问权限的情况下上传到Amazon S3&;密钥,php,amazon-s3,Php,Amazon S3,使用PHP,我想上传一些文件到AmazonS3公共存储桶。但我不想在代码中使用访问密钥和密钥。因为当我搜索发现使用关键字“null”可以解决这个问题。在PHP中,我们使用“”作为null,但运气不好。下面是我的代码 <?php if (!class_exists('s3'))require_once('s3.php'); //AWS access info if (!defined('awsAccessKey')) define('awsAccessKey', 'null'); if (
<?php
if (!class_exists('s3'))require_once('s3.php');
//AWS access info
if (!defined('awsAccessKey')) define('awsAccessKey', 'null');
if (!defined('awsSecretKey')) define('awsSecretKey', 'null');
//instantiate the class
$s3 = new S3(awsAccessKey, awsSecretKey);
$s3->putBucket("bucket name", S3::ACL_PUBLIC_READ_WRITE);
//move the file
if ($s3->putObjectFile("your file name in the server with path", "bucket name", "fine name in s3 server",S3::ACL_PUBLIC_READ_WRITE)){
//s3 upload success
}
请参见此处。。。然后像news3一样尝试(null,null)代码>,当前必须将null作为字符串。抱歉,出现此错误[AccessDenied]此操作禁止匿名访问