This returns the contents of the file.

var_dump(file_get_contents('file:///tmp/arhive_test/arhive_test.zip')); 

This gives the error failed to open stream: operation failed

 file_get_contents('zip:///tmp/arhive_test/arhive_test.zip'); 

It doesn't work either.

 var_dump(file_get_contents('zip://file:///tmp/arhive_test/arhive_test.zip')); 

Vraper installed

 php > print_r(stream_get_wrappers()); Array ( [0] => https [1] => ftps [2] => compress.zlib [3] => compress.bzip2 [4] => php [5] => file [6] => glob [7] => data [8] => http [9] => ftp [10] => phar [11] => zip ) 

This is how it works.

 $za = new ZipArchive(); php > $za->open('/tmp/arhive_test/arhive_test.zip'); 

    1 answer 1

    the answer turned out to be simple, this wrapper gets stream only for the object in the archive and not for the archive itself.

    So not right

     file_get_contents('zip:///tmp/arhive_test/arhive_test.zip') 

    That's right

     file_get_contents('zip:///tmp/arhive_test/arhive_test.zip#doc1.txt')