reaway/think-filesystem-driver-sftp 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

reaway/think-filesystem-driver-sftp

最新稳定版本:v1.0.0

Composer 安装命令:

composer require reaway/think-filesystem-driver-sftp

包简介

thinkphp filesystem sftp driver

README 文档

README

安装

composer require reaway/think-filesystem-driver-sftp

用法

在config/filesystem.php添加配置

return [
    'default' =>  'local',
    'disks'   => [
        'local'  => [
            'type' => 'local',
            'root'   => app()->getRuntimePath() . 'storage',
        ],
        'public' => [
            'type'     => 'local',
            'root'       => app()->getRootPath() . 'public/storage',
            'url'        => '/storage',
            'visibility' => 'public',
        ],
        // 添加配置
         'sftp'  => [
            'type' => 'sftp',
            'root' => 'uploads',
            'connection' => [
                'host' => '127.0.0.1',
                // 基于基础的身份验证设置...
                'username' => 'username',
                'password' => 'password',
                // 可选的 SFTP 设置
                'port' => 22,
            ]
        ],
    ],
];

使用

use think\facade\Filesystem;

$savename = Filesystem::disk('sftp')->putFile('topic', $file);

文档

详细参考 https://doc.thinkphp.cn/v8_0/upload.html

统计信息

  • 总下载量: 4
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2025-07-02