简体   繁体   English

我如何在不通过PHP提取文件的情况下以zip文件打开文件

[英]how i can open a file in zip file without extract it by the PHP

我只想制作一个可以打开zip存档中的文件的系统,就像我在该file.text中拥有archive.zip一样。我想要创建一个类来使此页面成为zip.php?archiver = archive.zip&file = file.text我想要此页面向我显示file.text内容有什么想法吗?

From the PHP manual: ZipArchive::getFromName() . 从PHP手册中: ZipArchive :: getFromName() This is exactly what you need. 这正是您所需要的。

<?php
$z = new ZipArchive();
if ($z->open(dirname(__FILE__) . '/test_im.zip')) {
    $string = $z->getFromName("mytext.txt");
    echo $string;
}
?>

Best wishes, 最好的祝愿,
Fabian 法比安

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM