mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-01 15:32:48 +08:00
重构默认本地上传组件;
This commit is contained in:
30
extend/think/filesystem/driver/LocalPublic.php
Normal file
30
extend/think/filesystem/driver/LocalPublic.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace think\filesystem\driver;
|
||||
|
||||
use think\facade\Request;
|
||||
|
||||
class LocalPublic extends Local
|
||||
{
|
||||
public function url(string $path): string
|
||||
{
|
||||
|
||||
$url = sysconfig('upload', 'local_domain');
|
||||
|
||||
if (empty($url)) {
|
||||
$host = Request::host();
|
||||
|
||||
if (!empty($host)) {
|
||||
$url = Request::domain();
|
||||
}
|
||||
}
|
||||
if (isset($this->config['url'])) {
|
||||
$url = trim($url, '/') . '/' . trim($this->config['url'], '/');
|
||||
}
|
||||
|
||||
if (isset($url)) {
|
||||
return $this->concatPathToUrl($url, $path);
|
||||
}
|
||||
return parent::url($path);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user