【问题标题】:How set Meta data key in php for Rackspace Cloud API如何在 php 中为 Rackspace Cloud API 设置元数据键
【发布时间】:2012-09-04 10:59:36
【问题描述】:

我在 PHP 中使用 Rackspace 云服务器的云文件 API,我想生成一个临时 url 来下载文件以直接到我的服务器,为此我正在使用此 api 的 get_temp() 方法,但在使用此方法之前我必须为我的容器设置元数据键。我该怎么做。

 public function get_temp_url($key, $expires, $method)
{

    $expires += time();
    $url = $this->container->cfs_http->getStorageUrl() .  '/' . $this->container->name . '/' . $this->name;
    return $url . '?temp_url_sig=' . hash_hmac('sha1', strtoupper($method) .
           "\n" . $expires . "\n" . parse_url($url, PHP_URL_PATH), $key) .
           '&temp_url_expires=' . $expires;
}

【问题讨论】:

    标签: php file-upload cloud rackspace


    【解决方案1】:

    此页面上的 cmets 包含一个如何设置的示例:

    http://docs.rackspace.com/files/api/v1/cf-devguide/content/Set_Account_Metadata-d1a4460.html

    另外,如果您使用新的 Cloud Files API...

    https://github.com/rackspace/php-opencloud

    ...它在 ObjectStore 类中包含一个 SetTempUrlSecret 方法,它将为您执行此操作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-05-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-01
      • 2023-03-22
      • 2016-03-01
      相关资源
      最近更新 更多