简体   繁体   English

什么是aws-sdk-php-laravel中的OBJECT_KEY

[英]What is OBJECT_KEY in aws-sdk-php-laravel

I am using "aws-sdk-php-laravel" package in my laravel 5 project. 我在laravel 5项目中使用“ aws-sdk-php-laravel”软件包。 which used amazonS3 for storage. 使用amazonS3进行存储。 But what is OBJECT_KEY and where to get it. 但是什么是OBJECT_KEY以及从何处获得它。

$s3 = App::make('aws')->createClient('s3');
$s3->putObject(array(
'Bucket'     => 'YOUR_BUCKET',
'Key'        => 'YOUR_OBJECT_KEY',
'SourceFile' => '/the/path/to/the/file/you/are/uploading.ext',
));

It's name of your file on S3 . 这是您在S3上的文件名。

You can check it here . 您可以在这里检查。

It's the name of the file on S3. 这是S3上文件的名称。 Just to make things a little easier to understand, don't think of S3 as a filesystem. 只是为了使事情更容易理解,不要将S3视为文件系统。 Think of it as a key data store. 将其视为关键数据存储。

So you have a key, the 'file name', and the data associated with it. 因此,您有一个密钥,“文件名”以及与之关联的数据。 In this instance it is your 'SourceFile' variable which is a location to a file on your local filesystem (not s3). 在这种情况下,您的'SourceFile'变量是本地文件系统上文件的位置(不是s3)。 All content in that source file will be uploaded against the key name. 该源文件中的所有内容都将根据密钥名上载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM