本文整理汇总了PHP中Zend_Service_Amazon_S3::getEndpoint方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Service_Amazon_S3::getEndpoint方法的具体用法?PHP Zend_Service_Amazon_S3::getEndpoint怎么用?PHP Zend_Service_Amazon_S3::getEndpoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Service_Amazon_S3
的用法示例。
在下文中一共展示了Zend_Service_Amazon_S3::getEndpoint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCreateObjectSSL
/**
* Test creating object with https
*
* ZF-7029
*/
public function testCreateObjectSSL()
{
$this->_amazon->setEndpoint('https://s3.amazonaws.com');
$this->assertEquals('https://s3.amazonaws.com', $this->_amazon->getEndpoint()->getUri());
$this->_amazon->createBucket($this->_bucket);
$this->_amazon->putObject($this->_bucket . "/zftest", "testdata");
$this->assertEquals("testdata", $this->_amazon->getObject($this->_bucket . "/zftest"));
}
示例2: getUri
/**
* Get a URI for a "stored" file.
*
* @see http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?RESTAuthentication.html#RESTAuthenticationQueryStringAuth
* @param string $path
* @return string URI
*/
public function getUri($path)
{
$endpoint = $this->_s3->getEndpoint();
$object = urlencode($this->_getObjectName($path));
$uri = "{$endpoint}/{$object}";
if ($expiration = $this->_getExpiration()) {
$date = new Zend_Date();
$date->add($expiration, Zend_Date::MINUTE);
$accessKeyId = $this->_options[self::AWS_KEY_OPTION];
$secretKey = $this->_options[self::AWS_SECRET_KEY_OPTION];
$expires = $date->getTimestamp();
$stringToSign = "GET\n\n\n{$expires}\n/{$object}";
$signature = base64_encode(Zend_Crypt_Hmac::compute($secretKey, 'sha1', utf8_encode($stringToSign), Zend_Crypt_Hmac::BINARY));
$query['AWSAccessKeyId'] = $accessKeyId;
$query['Expires'] = $expires;
$query['Signature'] = $signature;
$queryString = http_build_query($query);
$uri .= "?{$queryString}";
}
return $uri;
}