简体   繁体   English

如何读取远程 zip 存档中的单个文件(带 zip 的 url)

[英]How to read a single file inside a remote zip archive (url with zip)

I would like to read zip file with TXT file inside, but my zip exists on different url, not on the local machine.我想读取里面有 TXT 文件的 zip 文件,但是我的 zip 存在于不同的 url 上,而不是在本地机器上。 I tried both ways without success.我尝试了两种方法都没有成功。

  1. $result = file_get_contents('zip://http://www.abcde.com/12345.zip#1234.txt'); $result = file_get_contents('zip://http://www.abcde.com/12345.zip#1234.txt'); or要么
  2. $fp = fopen('zip://http://www.abcde.com/12345.zip#1234.txt', 'r'); $fp = fopen('zip://http://www.abcde.com/12345.zip#1234.txt', 'r'); Any idea how to do it?知道怎么做吗?

The best solution is to copy the zip from remote to local and then it should work better.最好的解决方案是将 zip 从远程复制到本地,然后它应该会更好地工作。

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

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