From e7beb27d382e110eeb25a7a5e07357185d397fcf Mon Sep 17 00:00:00 2001 From: gongfuxiang <2499232802@qq.com> Date: Wed, 19 Dec 2018 01:22:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BB=E9=A2=98=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/service/ThemeService.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/application/service/ThemeService.php b/application/service/ThemeService.php index 67e909ebc..a45e1ab30 100644 --- a/application/service/ThemeService.php +++ b/application/service/ThemeService.php @@ -90,6 +90,16 @@ class ThemeService return DataReturn('文件格式有误,请上传zip压缩包', -2); } + // 目录是否有权限 + if(!is_writable(ROOT.self::$html_path)) + { + return DataReturn('视图目录没权限', -10); + } + if(!is_writable(ROOT.self::$static_path)) + { + return DataReturn('资源目录没权限', -10); + } + // 开始解压文件 $resource = zip_open($_FILES['theme']['tmp_name']); while(($temp_resource = zip_read($resource)) !== false) @@ -105,10 +115,10 @@ class ThemeService // 拼接路径 if(strpos($file, '_html') !== false) { - $file = self::$html_path.$file; + $file = ROOT.self::$html_path.$file; } else if(strpos($file, '_static') !== false) { - $file = self::$static_path.$file; + $file = ROOT.self::$static_path.$file; } else { continue; }