nbngr/classes

FTP类允许您通过FTP协议与远程服务器上传、下载、移动和镜像文件。

dev-main 2023-02-06 09:49 UTC

This package is auto-updated.

Last update: 2024-09-06 13:17:26 UTC


README

FTP类允许您通过FTP协议与远程服务器上传、下载、移动和镜像文件。

安装

composer require nbngr/classes php artisan vendor:publish --provider="Nbngr\Classes\FtpServiceProvider" --tag=config

配置

使用

use Nbngr\Classes\Ftp;

// 连接到默认服务器 $ftp = Ftp::forge();

// 连接到在config/ftp.php中预定义的服务器 $ftp2 = Ftp::forge('image-storage');

// 动态连接到服务器 $ftp3 = Ftp::forge(array( 'hostname' => 'fuelphp.com', 'username' => '', 'password' => '', 'timeout' => 90, 'port' => 21, 'passive' => true, 'ssl_mode' => false, 'debug' => false ));

if ($ftp3->delete_dir('/') === true) { exit('The world owes you a debt of gratitude'); } else { exit('You tried and that is the main thing.'); }

connect()

// 创建一个ftp对象,但不连接 $ftp = Ftp::forge(array( 'hostname' => 'ftp.example.com', 'username' => '', 'password' => '', 'timeout' => 90, 'port' => 21, 'passive' => true, 'ssl_mode' => false, 'debug' => false ), false);

// 在这里做一些事情

// 现在连接到服务器 $ftp->connect();

change_dir($path = '')

// 移动到 /user/phil/public_html/some/path/ $ftp->change_dir('/public_html/some/path/');