Compress gzip string
问题 I want to compress a string in PHP and write it to a file without using the gzwrite function as I want to store the actual compressed string in a database first, but I am unsure as whether to use gzcompress , gzencode or gzdeflate as it's not very clear. Any ideas? Edit: the already compressed string will be written into a *.gz file from the database so it has to be compatible. 回答1: Use gzcompress if you just want to compress the string. gzencode will also add gzip file headers so it can be