public getBucketWebsite ( string $bucket, array $options = NULL ) : OSS\Model\WebsiteConfig | ||
$bucket | string | bucket名称 |
$options | array | |
return | OSS\Model\WebsiteConfig |
public function getBucketWebsite($bucket, $options = NULL)
{
$this->precheckCommon($bucket, NULL, $options, false);
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_METHOD] = self::OSS_HTTP_GET;
$options[self::OSS_OBJECT] = '/';
$options[self::OSS_SUB_RESOURCE] = 'website';
$response = $this->auth($options);
$result = new GetWebsiteResult($response);
return $result->getData();
}
/** * 获取bucket的静态网站托管状态 * * @param OssClient $ossClient OssClient实例 * @param string $bucket 存储空间名称 * @return null */ function getBucketWebsite($ossClient, $bucket) { $websiteConfig = null; try { $websiteConfig = $ossClient->getBucketWebsite($bucket); } catch (OssException $e) { printf(__FUNCTION__ . ": FAILED\n"); printf($e->getMessage() . "\n"); return; } print __FUNCTION__ . ": OK" . "\n"; print $websiteConfig->serializeToXml() . "\n"; }