How to create a gzip compressed string from text file in PHP

1 Answer

0 votes
$content = implode("", file("d:\\3LData.txt"));
$gzdata_encode = gzencode($content, 9);
$fp = fopen("d:\\3LData.txt.gz", "w");
fwrite($fp, $gzdata_encode);
fclose($fp);


/*
run:

3LData.txt.gz 129K
-------------------
    3LData.txt 296K
        

*/

 



answered Jun 25, 2016 by avibootz
...