doucu7330 2012-02-09 18:52
浏览 29
已采纳

像文件夹一样使用tar.gz文件?

Does PHP have an extension that permits to use a tar.gz like a folder?

I have some file that uses a similar structure and I don't need to extract all to read information about it, so can I make file_get_contents("my/path/to/tar/something.tar.gz/out.json");?

  • 写回答

1条回答 默认 最新

  • dongqiaochi2711 2012-02-09 18:56
    关注

    Use PHP's Phar extension. For an introduction, see PHP: Using Phar Archives: Introduction.

    file_get_contents("phar://my/path/to/tar/something.tar.gz/out.json");
    

    If you don't already have Phar, you can install the PHP_Archive package or use the PECL extension.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?