获取Bucket的CORS配置情况
public getBucketCors ( string $bucket, array $options = NULL ) : OSS\Model\CorsConfig | ||
$bucket | string | bucket名称 |
$options | array | 可以为空 |
return | OSS\Model\CorsConfig |
/** * 获取并打印bucket的cors配置 * * @param OssClient $ossClient OssClient实例 * @param string $bucket 存储空间名称 * @return null */ function getBucketCors($ossClient, $bucket) { $corsConfig = null; try { $corsConfig = $ossClient->getBucketCors($bucket); } catch (OssException $e) { printf(__FUNCTION__ . ": FAILED\n"); printf($e->getMessage() . "\n"); return; } print __FUNCTION__ . ": OK" . "\n"; print $corsConfig->serializeToXml() . "\n"; }