This commit is contained in:
2020-08-31 01:54:20 +08:00
parent 678fb07bd1
commit b11b132cfc
3 changed files with 24 additions and 51 deletions
+7 -7
View File
@@ -43,11 +43,11 @@ if (!function_exists('storage')) {
function storage($fileName = '', $path = '')
{
$basePath = Snowflake::getStoragePath();
// if (empty($path)) {
// return $basePath . '/' . $fileName;
// } else if (empty($fileName)) {
// return initDir($basePath, $path);
// }
if (empty($path)) {
return $basePath . '/' . $fileName;
} else if (empty($fileName)) {
return initDir($basePath, $path);
}
return initDir($basePath, $path) . $fileName;
}
@@ -64,10 +64,10 @@ if (!function_exists('storage')) {
foreach ($explode as $value) {
$path .= $value . '/';
if (!is_dir($basePath . $path)) {
// mkdir($basePath . $path);
mkdir($basePath . $path);
}
if (!is_dir($basePath . $path)) {
// throw new Exception('System error, directory ' . $basePath . $path . ' is not writable');
throw new Exception('System error, directory ' . $basePath . $path . ' is not writable');
}
}
return realpath($basePath . $path);