PHP解壓文件

3年以前  |  閱讀數:132 次  |    

storage_path("cache");為路徑函數,在使用時,需要替換成自己的方法,以便使其解壓到指定目錄。

function unzipFile($filePath)
    {
        $destDir = "";
        try {
            $zip = new ZipArchive();
            if ($zip->open($filePath, ZipArchive::FL_COMPRESSED) === TRUE) {
                $cacheDir = storage_path("cache");
                $destDir = $cacheDir . "/temp_zip_dir";
                mkdir($destDir);

                $zip->extractTo($destDir);
            }
            $zip->close();
        } catch (\Exception $e) {
        }

        return $destDir;
    }

相關文章:

18禁止午夜福利体验区,人与动人物xxxx毛片人与狍,色男人窝网站聚色窝,女生把筷子放屁眼里,国产精品久久久,国产日产欧洲无码视频