Commit 7405b6c4 authored by 杨培's avatar 杨培

Qiniu 组件获取文件URL支持私有空间

parent bef32aea
......@@ -35,13 +35,23 @@ class Qiniu extends Object
{
return call_user_func_array([$this, 'getUrl'], explode(':', $skey));
}
public function getUrl($storage, $key) {
/**
* 获取实际文件访问地址
*
* @param string $storage 存储名
* @param string $key 七牛文件key
* @param int $expires 私有空间地址有效期,默认一小时
* @return string
*/
public function getUrl($storage, $key, $expires=3600) {
if (!isset($this->storages[$storage])) {
return $key;
}
return $this->storages[$storage]['url'].$key;
$url = $this->storages[$storage]['url'].$key;
return $storage == 'video' ? $this->getAuthInstance()->privateDownloadUrl($url, $expires) : $url;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment