From 7829f7679bbf1f8e828cbaaa03f1fd209609b786 Mon Sep 17 00:00:00 2001 From: augushong Date: Wed, 8 Nov 2023 10:37:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=9B=E5=BB=BA=E7=9B=AE?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/base/common/tools/PathToolsBase.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/extend/base/common/tools/PathToolsBase.php b/extend/base/common/tools/PathToolsBase.php index c132925..fbabee6 100644 --- a/extend/base/common/tools/PathToolsBase.php +++ b/extend/base/common/tools/PathToolsBase.php @@ -47,7 +47,15 @@ class PathToolsBase } if (!is_dir($dir_name)) { - mkdir($dir_name, 0777, true); + try { + mkdir($dir_name, 0777, true); + } catch (\Exception $th) { + if (!is_dir($dir_name)) { + throw $th; + } + + return $file_path; + } } return $file_path; @@ -105,11 +113,11 @@ class PathToolsBase } /** - * 比较两个文件是否相同 + * 比较两个文件是否相同. * * @param string $a * @param string $b - * @return boolean 如果一致返回true,否则返回false + * @return bool 如果一致返回true,否则返回false */ public static function compareFiles($a, $b):bool {