Home >Backend Development >PHP Tutorial >How to read individual files in a zip archive using PHP
To read a single file in a zip archive, the code is as follows −
$handle = fopen('zip://test.zip#test.txt', 'r'); $result = ''; while (!feof($handle)) { $result .= fread($handle, 8192); } fclose($handle); echo $result;
The output will be the contents of the zip file.
The above is the detailed content of How to read individual files in a zip archive using PHP. For more information, please follow other related articles on the PHP Chinese website!