提交 43a150f2 编写于 作者: G gongfuxiang

zip类不存在校验

上级 c8e2cf96
......@@ -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, '/'))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册