You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
但是生成文件 url 路径时就会报错 :This driver does not support retrieving URLs.
源码调试发现 Laravel 7 代码如下 :
// Illuminate\Filesystem\FilesystemAdapter;/** * Get the URL for the file at the given path. * * @param string $path * @return string * * @throws \RuntimeException */publicfunctionurl($path)
{
$adapter = $this->driver->getAdapter();
if ($adapterinstanceof CachedAdapter) {
$adapter = $adapter->getAdapter();
}
// var_dump($path); die;// var_dump($adapter); die;var_dump(method_exists($adapter, 'getUrl')); die;
if (method_exists($adapter, 'getUrl')) {
return$adapter->getUrl($path);
} elseif (method_exists($this->driver, 'getUrl')) {
return$this->driver->getUrl($path);
} elseif ($adapterinstanceof AwsS3Adapter) {
return$this->getAwsUrl($adapter, $path);
} elseif ($adapterinstanceof Ftp) {
return$this->getFtpUrl($path);
} elseif ($adapterinstanceof LocalAdapter) {
return$this->getLocalUrl($path);
} else {
thrownewRuntimeException('This driver does not support retrieving URLs.');
}
}
上面代码检测 $adapter 是否有 getUrl 方法,但 flysystem-aliyun-oss 库中 AliyunOssAdapter 类并没有 getUrl 方法,导致上面逻辑总是走到 throw new RuntimeException('This driver does not support retrieving URLs.');
不知道是我写的问题还是 flysystem-aliyun-oss 库本身 Bug,还是我写的有问题
The text was updated successfully, but these errors were encountered:
我使用 flysystem-aliyun-oss 进行文件上传,文件可以正常上传到阿里云 OSS 服务器
但是生成文件 url 路径时就会报错 :This driver does not support retrieving URLs.
源码调试发现 Laravel 7 代码如下 :
上面代码检测 $adapter 是否有 getUrl 方法,但 flysystem-aliyun-oss 库中 AliyunOssAdapter 类并没有 getUrl 方法,导致上面逻辑总是走到 throw new RuntimeException('This driver does not support retrieving URLs.');
不知道是我写的问题还是 flysystem-aliyun-oss 库本身 Bug,还是我写的有问题
The text was updated successfully, but these errors were encountered: