c3/php-storage

dev-master 2018-03-30 06:04 UTC

This package is auto-updated.

Last update: 2024-09-08 06:49:13 UTC


README

用法

创建存储对象

$storage = StorageFactory::create(
    StorageTypeEnum::WEB_DAV(),
    'https://webdav.example.com',
    [
        'prefix' => 'basePathToWebDAV/',
        'userName' => 'user',
        'password' => 'password',
    ]
);

将远程文件流到本地文件系统

$this->storage->download('remotePathInsideWebDAV/test.txt', 'localPath/test.txt');

获取远程文件内容

$content = $this->storage->downloadContent('remotePathInsideWebDAV/test.txt');

将远程文件夹结构同步到本地文件系统(递归)

$localFile = new \SplFileInfo('localPath/');
storage->syncRemoteToLocal('remotePathInsideWebDAVRoot/', $localFile,true);

致谢