mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-08-31 05:05:33 +08:00
28 lines
744 B
PHP
28 lines
744 B
PHP
<?php
|
|
|
|
namespace think\filesystem\driver;
|
|
|
|
use League\Flysystem\FilesystemAdapter;
|
|
use League\Flysystem\WebDAV\WebDAVAdapter;
|
|
use Sabre\DAV\Client;
|
|
use think\filesystem\Driver;
|
|
|
|
class Webdav extends Driver
|
|
{
|
|
protected function createAdapter(): FilesystemAdapter
|
|
{
|
|
$client = new Client([
|
|
'baseUri' => sysconfig('upload', 'webdav_url'),
|
|
'userName' => sysconfig('upload', 'webdav_username'),
|
|
'password' => sysconfig('upload', 'webdav_password'),
|
|
]);
|
|
|
|
return new WebDAVAdapter($client, sysconfig('upload', 'webdav_prefix', ''));
|
|
}
|
|
|
|
public function url(string $path): string
|
|
{
|
|
return $this->concatPathToUrl(sysconfig('upload', 'webdav_domain'), $path);
|
|
}
|
|
}
|