本文整理汇总了PHP中Aws\S3\S3Client::isBucketDnsCompatible方法的典型用法代码示例。如果您正苦于以下问题:PHP S3Client::isBucketDnsCompatible方法的具体用法?PHP S3Client::isBucketDnsCompatible怎么用?PHP S3Client::isBucketDnsCompatible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aws\S3\S3Client
的用法示例。
在下文中一共展示了S3Client::isBucketDnsCompatible方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setBucketStyle
/**
* Changes how buckets are referenced in the HTTP request
*
* @param PreparedEvent $event Event emitted
*/
public function setBucketStyle(PreparedEvent $event)
{
$command = $event->getCommand();
$request = $event->getRequest();
$bucket = $command['Bucket'];
$path = $request->getPath();
if (!$bucket || isset(self::$exclusions[$command->getName()])) {
return;
}
if ($this->bucketEndpoint) {
$path = $this->removeBucketFromPath($path, $bucket);
} elseif (!$command['PathStyle'] && S3Client::isBucketDnsCompatible($bucket) && !($request->getScheme() == 'https' && strpos($bucket, '.'))) {
// Switch to virtual if PathStyle is disabled, or not a DNS
// compatible bucket name, or the scheme is https and there are no
// dots in the hostheader (avoids SSL issues).
$request->setHost($bucket . '.' . $request->getHost());
$path = $this->removeBucketFromPath($path, $bucket);
}
// Modify the Key to make sure the key is encoded, but slashes are not.
if ($command['Key']) {
$path = S3Client::encodeKey(rawurldecode($path));
}
$request->setPath($path);
}
示例2: canAccelerate
private function canAccelerate(CommandInterface $command)
{
return empty(self::$exclusions[$command->getName()]) && S3Client::isBucketDnsCompatible($command['Bucket']);
}