ALIOSS::list_bucket PHP Метод

list_bucket() публичный Метод

Get Buket list
С версии: 2011-11-14
Автор: [email protected]
public list_bucket ( array $options = null ) : ResponseCore
$options array (Optional)
Результат ResponseCore
    public function list_bucket($options = null)
    {
        //$options
        $this->validate_options($options);
        if (!$options) {
            $options = array();
        }
        $options[self::OSS_BUCKET] = '';
        $options[self::OSS_METHOD] = 'GET';
        $options[self::OSS_OBJECT] = '/';
        $response = $this->auth($options);
        return $response;
    }

Usage Example

Пример #1
0
function attachment_alioss_buctkets($key, $secret)
{
    require '../framework/library/alioss/sdk.class.php';
    $oss = new ALIOSS($key, $secret);
    $response = $oss->list_bucket();
    if (!empty($response)) {
        $xml = isimplexml_load_string($response->body, 'SimpleXMLElement', LIBXML_NOCDATA);
        $buckets = json_decode(json_encode($xml), true);
    }
    if (empty($buckets['Buckets']['Bucket'][0])) {
        $buckets['Buckets']['Bucket'] = array($buckets['Buckets']['Bucket']);
    }
    $bucket_container = array();
    if (!empty($buckets['Buckets']['Bucket'])) {
        foreach ($buckets['Buckets']['Bucket'] as $bucket) {
            $bucket_container[$bucket['Name']] = array('name' => $bucket['Name'], 'location' => $bucket['Location']);
        }
    }
    return $bucket_container;
}
All Usage Examples Of ALIOSS::list_bucket