Created
February 18, 2013 14:47
-
-
Save wokamoto/4977932 to your computer and use it in GitHub Desktop.
[PHP][AWS] S3 オブジェクトの存在確認
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once("aws.phar"); | |
use Aws\Common\Aws; | |
use Aws\Common\Enum\Region; | |
use Aws\S3\Enum\CannedAcl; | |
use Aws\S3\Exception\S3Exception; | |
$s3 = Aws::factory(array( | |
'key' => $access_key, | |
'secret' => $secret_key, | |
'region' => Region::AP_NORTHEAST_1, | |
))->get('s3'); | |
$s3->doesObjectExist($bucket, $key); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
doesObjectExistを使うと存在していてもfalseになる場合があります。
listObjectsのほうがいいかと