Coder Social home page Coder Social logo

Comments (9)

overtrue avatar overtrue commented on July 1, 2024

感谢反馈!

from flysystem-cos.

mogody avatar mogody commented on July 1, 2024

而且这样写法其实也是不对,看了源码后,提交额外参数要这么写:

        $result = $filesystem->writeStream($saveKey, $stream, [
            'params'    =>  [
                'Cache-Control'  =>  'max-age=2592000'
            ]
        ]);

但是这样其实是无效的,原因就是底层用的cos-sdk-v5不支持params参数,这是底层put请求的代码:

$rt = $this->putObject(array(
     'Bucket' => $bucket,
      'Key'    => $key,
      'Body'   => $body,
 ) + $options);

最终组合的结果是(错误的):

$rt = $this->putObject([
    'Bucket' => $bucket,
    'Key'    => $key,
    'Body'   => $body,
    'params'    =>  [
          'CacheControl'  =>  'max-age=2592000'
    ]
]);

而正确的 应该是这样:

$rt = $this->putObject([
    'Bucket' => $bucket,
    'Key'    => $key,
    'Body'   => $body,
   'CacheControl'  =>  'max-age=2592000'
]);

也就是说不能有 params 这个外层嵌套包裹,可以看看这个文档:https://github.com/tencentyun/cos-php-sdk-v5

from flysystem-cos.

overtrue avatar overtrue commented on July 1, 2024

欢迎 PR

from flysystem-cos.

overtrue avatar overtrue commented on July 1, 2024

看了一下,调用的时候还是不能少 params 这层,因为 Flysystem Config 类不支持 toArray,所以必须套一层:https://github.com/thephpleague/flysystem/blob/1.x/src/Config.php

from flysystem-cos.

overtrue avatar overtrue commented on July 1, 2024

看看这么改是不是 OK?

from flysystem-cos.

mogody avatar mogody commented on July 1, 2024

恩这样应该就OK了,明天上班我拉下来试试看

from flysystem-cos.

overtrue avatar overtrue commented on July 1, 2024

@mogody 感谢

from flysystem-cos.

mogody avatar mogody commented on July 1, 2024

是不是忘记打 tag 了?:joy:

from flysystem-cos.

overtrue avatar overtrue commented on July 1, 2024

@mogody https://github.com/overtrue/flysystem-cos/releases/tag/2.1.2

from flysystem-cos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.