Home  >  Article  >  Backend Development  >  七牛云7.0的SDK私有下载

七牛云7.0的SDK私有下载

WBOY
WBOYOriginal
2016-06-06 20:23:051249browse

看到官网下载都是7.0版本以上的,结果sdk文档却是6.0的,什么时候能出7的sdk文档?特别是针对私有资源下载的几乎是没有

回复内容:

看到官网下载都是7.0版本以上的,结果sdk文档却是6.0的,什么时候能出7的sdk文档?特别是针对私有资源下载的几乎是没有

有提供的,多看看文档吧.

PHP V7SDK文档

<code>use Qiniu\Auth;

$accessKey = 'Access_Key';
$secretKey = 'Secret_Key';

// 构建鉴权对象
$auth = new Auth($accessKey, $secretKey);

// 要上传的空间
$bucket = 'rainwsy';

// 私有空间中的外链 http://<domain>/<file_key>
$baseUrl = 'http://7xox85.com1.z0.glb.clouddn.com/resume.doc';
// 对链接进行签名
$signedUrl = $auth->privateDownloadUrl($baseUrl);

echo $signedUrl;</file_key></domain></code>
<code>public function privateDownloadUrl($baseUrl, $expires = 3600)
    {
        $deadline = time() + $expires;

        $pos = strpos($baseUrl, '?');
        if ($pos !== false) {
            $baseUrl .= '&e=';
        } else {
            $baseUrl .= '?e=';
        }
        $baseUrl .= $deadline;

        $token = $this->sign($baseUrl);
        return "$baseUrl&token=$token";
    }</code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn