• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

七牛云存储 – 七牛云 V7 版本的PHP SDK 是不是还没有做完,为什么找不到删除,移动资源的功能?

php 搞代码 3年前 (2022-01-25) 12次浏览 已收录 0个评论
文章目录[隐藏]

好奇怪 官方的文档上明明写了
此 SDK 包含了如下几个功能:

数据的上传和下载。

数据的管理: 复制,移动,删除,获取元信息,列取文件。

数据的处理: 图片的处理,音视频的处理,文档的处理。

这咋这么不负责任呢?

回复内容:

好奇怪 官方的文档上明明写了
此 SDK 包含了如下几个功能:

数据的上传和下载。

数据的管理: 复制,移动,删除,获取元信息,列取文件。

数据的处理: 图片的处理,音视频的处理,文档的处理。

这咋这么不负责任呢?

七牛这些功能都有啊,你可以看看他们源码:

https://github.com/qiniu/php-sdk/tree/v7.0.4

你说的这些功能代码里面都有的。

<code>use Qiniu\Storage\BucketManager;$bucketMgr = New BucketManager($this->auth);$bucketMgr->move(...);$bucketMgr->delete(...);</code>

一找就找到了

查看:https://github.com/qiniu/php-sdk/blob/v7.0.4/src/Qiniu/Storage/BucketManager.php
有相应的方法

<code>/**     * 删除指定资源     *     * @param $bucket     待删除资源所在的空间     * @param $key        待删除资源的文件名     *     * @return mixed      成功返回NULL,失败返回对象Qiniu\Http\Error     * @link  http://developer.qiniu.com/docs/v6/api/reference/rs/delete.html     */    public function delete($bucket, $key)    {        $path = '/delete/' . \Qiniu\entry($bucket, $key);        list(, $error) = $this->rsPost($path);        return $error;    }    /**     * 给资源进行重命名,本质为move操作。     *     * @param $bucket     待操作资源所在空间     * @param $oldname    待操作资源文件名     * @param $newname    目标资源文件名     *     * @return mixed      成功返回NULL,失败返回对象Qiniu\Http\Error     */    public function rename($bucket, $oldname, $newname)    {        return $this->move($bucket, $oldname, $bucket, $newname);    }    /**     * 给资源进行重命名,本质为move操作。     *     * @param $from_bucket     待操作资源所在空间     * @param $from_key        待操作资源文件名     * @param $to_bucket       目标资源空间名     * @param $to_key          目标资源文件名     *     * @return mixed      成功返回NULL,失败返回对象Qiniu\Http\Error     * @link  http://developer.qiniu.com/docs/v6/api/reference/rs/copy.html     */    public function copy($from_bucket, $from_key, $to_bucket, $to_key)    {        $from = \Qiniu\entry($from_bucket, $from_key);        $to = \Qiniu\entry($to_bucket, $to_key);        $path = '/copy/' . $from . '/' . $to;        list(, $error) = $this->rsPost($path);        return $error;    }    /**     * 将资源从一个空间到另一个空间     *     * @param $from_bucket     待操作资源所在空间     * @param $from_key        待操作资源文件名     * @param $to_bucket       目标资源空间名     * @param $to_key          目标资源文件名     *     * @return mixed      成功返回NULL,失败返回对象Qiniu\Http\Error     * @link  http://developer.q<p style="color:transparent">本文来源gao!%daima.com搞$代*!码$网3</p><strong>搞代gaodaima码</strong>iniu.com/docs/v6/api/reference/rs/move.html     */    public function move($from_bucket, $from_key, $to_bucket, $to_key)    {        $from = \Qiniu\entry($from_bucket, $from_key);        $to = \Qiniu\entry($to_bucket, $to_key);        $path = '/move/' . $from . '/' . $to;        list(, $error) = $this->rsPost($path);        return $error;    }</code>

搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:七牛云存储 – 七牛云 V7 版本的PHP SDK 是不是还没有做完,为什么找不到删除,移动资源的功能?

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址