Commit ef1e4364 authored by xiabin's avatar xiabin

Merge remote-tracking branch 'origin/master'

parents cf153565 95deaaba
......@@ -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