压缩gzip字符串 [英] Compress gzip string

查看:768
本文介绍了压缩gzip字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在PHP中压缩字符串,并将其写入文件,而不使用gzwrite函数,因为我想将实际压缩的字符串存储在数据库中,但我不确定是否使用 gzcompress gzencode gzdeflate

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.

任何想法?


  • 编辑:已经压缩的字符串

推荐答案

使用数据库中的* .gz文件gzcompress如果你只是想压缩字符串。
gzencode还将添加gzip文件头,因此可以通过gzip和类似工具直接解压缩。

Use gzcompress if you just want to compress the string. gzencode will also add gzip file headers so it can be uncompressed directly by gzip and similar tools.

gzdeflate使用deflate算法,非常类似于第一个一个。

gzdeflate uses the deflate algorithm which is very similar to the first one.

我想在这种情况下要使用 gzencode ,因为数据将被存储为一个文件。

I think yo want to use gzencode in ths case since the data is going to be stored as a file.

这篇关于压缩gzip字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆