【问题标题】:Laravel flysystem ftpd adapterLaravel flysystem ftpd 适配器
【发布时间】:2017-07-18 13:06:36
【问题描述】:

我想使用 Laravel 中的 ftpd Adapter 访问 Synology NAS,它似乎需要这个特定的适配器 https://github.com/thephpleague/flysystem/issues/305,但我收到错误

Driver [Ftpd] is not supported.

文件在那里:

vendor/league/flysystem/src/Adapter/Ftpd.php

我必须注册任何我可以使用的东西吗?

我尝试像这样在 filesystems.php 中使用它

    'diskstation' => [
        'driver'   => 'Ftpd',
        'host'     => 'ftp.domain.com',
        'username' => '****',
        'password' => '****',

        // Optional FTP Settings...
        'port'     => 21,
        'root'     => '',
        'passive'  => true,
        'ssl'      => false,
        'timeout'  => 10,
    ],

【问题讨论】:

  • 试试驱动小写,ftpd
  • 谢谢,已经试过了,不行

标签: php laravel laravel-5 thephpleague


【解决方案1】:

看起来 laravel 不支持开箱即用的 ftpd,你可以在这里看到:

https://github.com/laravel/framework/blob/5.4/src/Illuminate/Filesystem/FilesystemManager.php#L13

它导入了一些 Flysystem 驱动程序,但不导入 ftpd 驱动程序。

但是,您可以创建自定义驱动程序,如 here in the docs 所示。 ftpd驱动已经为flysystem构建好了,你只需要通过这个方法在laravel中导入即可。

【讨论】:

  • 谢谢,这有效.. ftpd 类已经存在,所以我可以创建一个服务提供者并将其添加到 boot() 方法中: Storage::extend('Ftpd', function ( $app, $config) { return new Filesystem(new Ftpd($config)); });
猜你喜欢
  • 2017-12-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-10-14
  • 1970-01-01
  • 2019-11-13
  • 2018-01-19
  • 1970-01-01
相关资源
最近更新 更多