是否可以在服务器上打开ZIP文件,从其内容中读取文件并将其显示/直接发送到客户端而不先将其提取到磁盘?我在谈论pdf's
和images
。没有在php网站上找到任何提示。
答案 0 :(得分:1)
Well,there is a PHP Extension. If you use the extractTo method, you would be able to extract a single file, checkout the documentation.
From the documentation, extracting two files:-
<?php
$zip = new ZipArchive;
$res = $zip->open('test_im.zip');
if ($res === TRUE) {
$zip->extractTo('/my/destination/dir/', array('pear_item.gif', 'testfromfile.php'));
$zip->close();
echo 'ok';
} else {
echo 'failed';
}
?>
You would need to provide an array of path inside the zip.