可以列出 zip/rar 文件内容的 PHP 库

发布于 2024-08-06 17:14:09 字数 132 浏览 5 评论 0原文

注意:我需要一个库,而不是链接到有关我的主机没有或想要安装的扩展的文档。

主题说明了一切。

我暂时不需要提取任何文件(尽管这可能是以后对我的网络应用程序的一个很好的补充),我只需要列出 rar 和 zip 存档的内容。

Note: I NEED A LIBRARY not links to documentation about extensions my host doesn't have or want installed.

The subject says it all.

I don't need to extract any files for the moment (although that might be a nice addition to my web app later) I just need to list the contents of rar and zip archives.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

说不完的你爱 2024-08-13 17:14:10

老实说,我不认为你会找到一个。如果我理解正确的话,您要求的是一个包含 rar 扩展名的库(为文件系统和压缩文件提供 php 访问和可用性:rar)本身。我真的不认为任何人会经历重建/移植/移动/提取/等 rar 扩展的麻烦,因为安装它更容易。如果我是你,我会联系主机,看看他们是否会安装它和/或迁移到新主机。

I honestly don't think you'll find one. What you're asking for is a library that includes the rar extension (giving php access and usability to the filesystem and compressed files: rar) itself if I'm understanding correctly. I really don't think anyone would go through the trouble of rebuilding/porting/moving/extracting/etc the rar extension when it's easier to install it. If I were you I'd contact the host to see if they'll install it and/or migrate to a new host.

网名女生简单气质 2024-08-13 17:14:10

PHP 压缩函数

包含您需要的一切(安装、使用示例)在该页面中。

列出 rar 文件就像

<?php

 $rar_file = rar_open('example.rar') or die("Can't open Rar archive");

 $entries = rar_list($rar_file);

 foreach ($entries as $entry) {
     echo 'Filename: ' . $entry->getName() . "\n";
     echo 'Packed size: ' . $entry->getPackedSize() . "\n";
     echo 'Unpacked size: ' . $entry->getUnpackedSize() . "\n";

     $entry->extract('/dir/extract/to/');
 }

 rar_close($rar_file);

 ?>

PHP Compression Functions

everything you need (installation, usage examples) is included in that page.

listing rar files is as easy as

<?php

 $rar_file = rar_open('example.rar') or die("Can't open Rar archive");

 $entries = rar_list($rar_file);

 foreach ($entries as $entry) {
     echo 'Filename: ' . $entry->getName() . "\n";
     echo 'Packed size: ' . $entry->getPackedSize() . "\n";
     echo 'Unpacked size: ' . $entry->getUnpackedSize() . "\n";

     $entry->extract('/dir/extract/to/');
 }

 rar_close($rar_file);

 ?>
风吹短裙飘 2024-08-13 17:14:10

phpinfo(); 如果您的虚拟主机

看到此 Rar 支持,您可以使用 PECL 的 rar 功能

这个类可以让事情变得简单

不然我不知道这是不是可能的

phpinfo(); you webhost

if you see this Rar support the you can use PECL's rar functions.

This class can make things simple

Or else I don't know if this is possible

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文