當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Service_Amazon_S3::getBuckets方法代碼示例

本文整理匯總了PHP中Zend_Service_Amazon_S3::getBuckets方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Service_Amazon_S3::getBuckets方法的具體用法?PHP Zend_Service_Amazon_S3::getBuckets怎麽用?PHP Zend_Service_Amazon_S3::getBuckets使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Service_Amazon_S3的用法示例。


在下文中一共展示了Zend_Service_Amazon_S3::getBuckets方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testCreateBucketEU

 /**
  * Test creating bucket with location
  * ZF-6728
  *
  */
 public function testCreateBucketEU()
 {
     $this->_amazon->createBucket($this->_bucket, 'EU');
     $this->assertTrue($this->_amazon->isBucketAvailable($this->_bucket));
     $list = $this->_amazon->getBuckets();
     $this->assertContains($this->_bucket, $list);
 }
開發者ID:vicfryzel,項目名稱:zf,代碼行數:12,代碼來源:OnlineTest.php

示例2: isValid

 public function isValid($data)
 {
     $valid = parent::isValid($data);
     // Custom valid
     if ($valid) {
         // Check auth
         try {
             $testService = new Zend_Service_Amazon_S3($data['accessKey'], $data['secretKey'], $data['region']);
             $buckets = $testService->getBuckets();
         } catch (Exception $e) {
             $this->addError('Please double check your access keys.');
             return false;
         }
         // Check bucket
         try {
             if (!in_array($data['bucket'], $buckets)) {
                 if (!$testService->createBucket($data['bucket'], $data['region'])) {
                     throw new Exception('Could not create or find bucket');
                 }
             }
         } catch (Exception $e) {
             $this->addError('Bucket name is already taken and could not be created.');
             return false;
         }
     }
     return $valid;
 }
開發者ID:febryantosulistyo,項目名稱:ClassicSocial,代碼行數:27,代碼來源:S3.php

示例3: testRemoveBucket

 public function testRemoveBucket()
 {
     $this->_amazon->createBucket($this->_bucket);
     $data = "testdata";
     $this->_amazon->putObject($this->_bucket . "/zftest", $data);
     $this->_amazon->cleanBucket($this->_bucket);
     $this->_amazon->removeBucket($this->_bucket);
     $this->assertFalse($this->_amazon->isBucketAvailable($this->_bucket));
     $this->assertFalse($this->_amazon->isObjectAvailable($this->_bucket . "/zftest"));
     $this->assertFalse($this->_amazon->getObjectsByBucket($this->_bucket));
     $list = $this->_amazon->getBuckets();
     $this->assertNotContains($this->_bucket, $list);
 }
開發者ID:heiglandreas,項目名稱:zf2,代碼行數:13,代碼來源:OnlineTest.php

示例4: testRemoveBucket

 public function testRemoveBucket()
 {
     $this->_amazon->createBucket($this->_bucket);
     $data = "testdata";
     $this->_amazon->putObject($this->_bucket . "/zftest", $data);
     $this->_amazon->cleanBucket($this->_bucket);
     $this->_amazon->removeBucket($this->_bucket);
     // otherwise amazon sends cached data
     sleep(2);
     $this->assertFalse($this->_amazon->isObjectAvailable($this->_bucket . "/zftest"), "Object shouldn't be available.");
     $this->assertFalse($this->_amazon->getObjectsByBucket($this->_bucket), "Bucket should be empty.");
     $this->assertFalse($this->_amazon->isBucketAvailable($this->_bucket), "Bucket shouldn't be available.");
     $list = $this->_amazon->getBuckets();
     $this->assertNotContains($this->_bucket, $list);
 }
開發者ID:tillk,項目名稱:vufind,代碼行數:15,代碼來源:OnlineTest.php

示例5: indexAction

 public function indexAction()
 {
     $s3 = new Zend_Service_Amazon_S3('AKIAJ5HTOSBB7ITPA6VQ', 'n8ZjV8xz/k/FxBGhrVduYlSXVFFmep7aZJ/NOsoj');
     $this->view->buckets = $s3->getBuckets();
     $bucketName = 'vaultman';
     $ret = $s3->getObjectsByBucket($bucketName);
     $this->view->objects = $ret;
     $this->view->form = new Mybase_Form_Files();
     $formData = $this->getRequest()->getPost();
     if ($this->_request->isPost()) {
         $s3->registerStreamWrapper("s3");
         //file_put_contents("s3://".$bucketName."/".$_FILES['img']['name'], fopen($_FILES['img']['tmp_name'], 'r'));
         $adapter = new Zend_File_Transfer_Adapter_Http();
         $adapter->setDestination("s3://" . $bucketName . "/");
         //$adapter->receive();
     }
 }
開發者ID:besters,項目名稱:My-Base,代碼行數:17,代碼來源:FilesController.php


注:本文中的Zend_Service_Amazon_S3::getBuckets方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。