PHP文件解压,压缩文件遍历,文件夹遍历
来源:互联网 发布:英语四级软件推荐 编辑:程序博客网 时间:2024/04/30 06:00
//解压文件//$zip = new ZipArchive();$path = '../files/CustomPortrait/2.0.zip';$unzipPath = '../files/CustomPortrait/2.0';//if ($zip->open($path) === true) {// $zip->extractTo($unzipPath);//}//$zip->close();////echo file_list($unzipPath);zip_test($path);function my_scandir($dir) { $files = array(); if (is_dir($dir)) { if ($handle = opendir($dir)) { while (($file = readdir($handle)) !== false) { if ($file != "." && $file != "..") { if (is_dir($dir . "/" . $file)) { $files[$file] = my_scandir($dir . "/" . $file); } else { $files[] = $dir . "/" . $file; } } } closedir($handle); return $files; } }}function file_list($path) { if ($handle = opendir($path)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { if (is_dir($path . "/" . $file)) { echo $path . ": " . $file . "<br>";//去掉此行显示的是所有的非目录文件 file_list($path . "/" . $file); } else { echo $path . ": " . $file . "<br>"; } } } }}function zip_test($path) { $test = array(); $zip = new ZipArchive(); if ($zip->open($path) === TRUE) { for ($i = 0; $i < $zip->numFiles; $i++) { $contents = $zip->getNameIndex($i); if(strpos($contents, '.png') !== false){ $test[$i] = $contents; } } } // print_r(array_values($test)); echo json_encode(array_values($test)); // echo json_encode($test); $zip->close();}
0 0
- PHP文件解压,压缩文件遍历,文件夹遍历
- 遍历文件夹下压缩文件并解压至指定文件夹
- php遍历文件夹、文件
- PHP遍历文件和文件夹
- php遍历文件和文件夹
- php遍历文件夹,查找文件
- 【PHP】文件操作及遍历文件夹
- PHP遍历文件夹下所有文件
- PHP遍历文件夹下所有文件
- 遍历文件夹和遍历文件
- php遍历文件夹
- 用PHP遍历文件夹
- PHP遍历文件夹
- php递归遍历文件夹
- PHP遍历文件夹
- php遍历文件夹
- PHP遍历文件夹内容
- PHP遍历文件夹目录
- Android中跨进程通讯的4种方式
- C# Windows - 菜单栏和工具栏
- css伪类
- sudo uograde 之后 需要重装显卡驱动
- Android库工程及代码混淆(project.properties、proguard-project.txt)
- PHP文件解压,压缩文件遍历,文件夹遍历
- iOS 手机号正则表达式
- MySQL解决[Err] 1206 - The total number of locks exceeds the lock table size问题
- cas 服务器安装
- 如何在生产中成功运用Docker
- Android基础-----Activity,Intent
- 弹出层弹出框
- eclipse新建maven项目报错
- 【C#】华南理工大学计算机考研复试题目