2012-04-27 16 views

答えて

8

Amazonは実際にprovides oneです。そして、それを使っているウェブにはたくさんの例があります。 Googleはあなたの友人です。

6

Amazonは、サンプルコード

// The sample code below demonstrates how Resource APIs work 


$aws = new Aws($config); 

// Get references to resource objects 



$bucket = $aws->s3->bucket('my-bucket'); 

$object = $bucket->object('image/bird.jpg'); 

// Access resource attributes 


echo $object['LastModified']; 

// Call resource methods to take action 


$object->delete(); 

$bucket->delete(); 

またはS3バケットにファイルをアップロードするため、古いs3.phpを使用するをチェックし、PHPSDKを持っています。その単一のphpファイルは、s3.php あなたはそれをあなたのコードからダウンロードします。詳細についてはthisをお読みください。

<?php 


if (!class_exists('S3'))require_once('S3.php'); 
//AWS access info 
if (!defined('awsAccessKey')) define('awsAccessKey', 'YourAccess S3 Key'); 
if (!defined('awsSecretKey')) define('awsSecretKey', 'Yor Secret Key'); 
//instantiate the class 
$s3 = new S3(awsAccessKey, awsSecretKey); 
$s3->putBucket("bucket name", S3::ACL_PRIVATE); 

//move the file 
if ($s3->putObjectFile("your file name in the server with path", "which bucket ur using (bucket name)", "fine name in s3 server", S3::ACL_PRIVATE)) { 

//s3 upload success 

} 
?> 
+0

このクラスはAmazonではありません。これは第三者クラスです。 –

+1

S3.php(はい、サードパーティのクラス)はAmazonのPHP SDKよりも小さく、シンプルだから探しています。最後にここにあります:https://raw.githubusercontent.com/tpyo/amazon-s3-php-class/master/S3.php – YudhiWidyatama

関連する問題