繁体   English   中英

如何在Rackspace Cloud API的php中设置元数据密钥

[英]How set Meta data key in php for Rackspace Cloud API

我正在PHP中使用Rackspace Cloud服务器的Cloud File 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;
}

此页面上的评论包括如何设置此示例:

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方法,该方法将为您完成此操作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM