overtrue / laravel-filesystem-qiniu

A Qiniu Storage filesystem for Laravel
471 stars 35 forks source link

fetch方法,文档的// fetch file $file = $disk->fetch('folder/my_file.txt');不成功 #12

Closed never615 closed 6 years ago

never615 commented 6 years ago

文档如下:

// fetch file 
$file = $disk->fetch('folder/my_file.txt');

源码中是接收两个参数?

namespace Overtrue\Flysystem\Qiniu\Plugins;

use League\Flysystem\Plugin\AbstractPlugin;

class FetchFile extends AbstractPlugin
{
    public function getMethod()
    {
        return 'fetch';
    }

    public function handle($path, $url)
    {
        return $this->filesystem->getAdapter()->fetch($path, $url);
    }
}
never615 commented 6 years ago

顺便问一下,私有空间的文件只能通过拿url的方式获取?不能用read方法获取是吧

overtrue commented 6 years ago

@never615 文档已经修复,另外,不论是公众空间还是私有,都是通过 url 来拿内容的, read 方法其实也是拿 url 的:

https://github.com/overtrue/flysystem-qiniu/blob/master/src/QiniuAdapter.php#L279

never615 commented 6 years ago

好的,谢谢