diff --git a/extend/base/ZipFolder.php b/extend/base/ZipFolder.php index e9ce15477a2e0b127c43ee12a09830fb73884fbf..1e4364d3b0fff43b7c0c473c0b37f8030d3b5a76 100755 --- a/extend/base/ZipFolder.php +++ b/extend/base/ZipFolder.php @@ -32,7 +32,12 @@ class ZipFolder */ public function __construct() { - $this->zip = new \ZipArchive(); + if(class_exists('ZipArchive')) + { + $this->zip = new \ZipArchive(); + } else { + throw new \Exception("当前PHP环境无Zip扩展"); + } } /** @@ -81,7 +86,7 @@ class ZipFolder $this->ignored_names = is_array($ignored) ? $ignored : ($ignored ? array($ignored) : array()); if($this->zip->open($zipfile, \ZipArchive::CREATE) !== true) { - throw new Exception("cannot open <$zipfile>\n"); + throw new \Exception("cannot open <$zipfile>\n"); } $folder = substr($folder, -1) == '/' ? substr($folder, 0, strlen($folder)-1) : $folder; if(strstr($folder, '/'))