PHP GZIP 更多信息
我使用 google 的 Firefox 插件“速度测试”,出现此错误:
启用压缩
使用 gzip 压缩以下资源可以将其传输大小减少 65.8KiB(减少 65%)。
现在..我对这个主题一无所知,我想了解更多关于这个主题的信息。
这与 OB 相关/连接(如 ob_start )或类似的东西?
我将很乐意获得有关此主题的更多信息和教程。
如果有视频指导就更好了。
这是我从 Google Speed Test 得到的完整通知:
使用 gzip 压缩以下资源可以将其传输大小减少 65.8KiB(减少 65%)。
Compressing http://localhost/english/jquery.js could save 57.3KiB (65% reduction).
Compressing http://localhost/english/javascript/slider.js could save 4.0KiB (69% reduction).
Compressing http://localhost/english/style/style.css could save 3.7KiB (72% reduction).
Compressing http://localhost/english/javascript/home.js could save 853B (62% reduction).
I use the plugin of google for firefox "speed test" and I have this error:
Enable compression
Compressing the following resources with gzip could reduce their transfer size by 65.8KiB (65% reduction).
Now.. I know nothing about this subject and I want to learn more about this subject.
This is related/connected to OB ( like ob_start ) or somthing like that?
I'll be gateful to get more information and tutorials about this subject.
If there are vidoe guides its even better.
This is the full notice that I've got from Google Speed Test:
Compressing the following resources with gzip could reduce their transfer size by 65.8KiB (65% reduction).
Compressing http://localhost/english/jquery.js could save 57.3KiB (65% reduction).
Compressing http://localhost/english/javascript/slider.js could save 4.0KiB (69% reduction).
Compressing http://localhost/english/style/style.css could save 3.7KiB (72% reduction).
Compressing http://localhost/english/javascript/home.js could save 853B (62% reduction).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
看一下
ob_gzhandler
。他们也有一个非常简单的例子:如果浏览器支持gzip,那么该页面将使用gzip压缩并压缩发送,之后浏览器将其解压缩并渲染它。这样做的优点是减少需要传输的字节量。
Take a look at
ob_gzhandler
. They have a very straight-forward example too:If the browser supports gzip, then this page will be compressed with gzip and sent compressed, after which the browser will decompress it and render it. The advantage of doing this is lowering the amount of bytes that need to be transferred.
背景
解释
当你想要向您的朋友发送一个大文件,您可以使用 zip、rar 或其他归档程序(如 gzip)对其进行压缩,以节省一些字节并使其更快。
您也可以执行相同的操作并压缩 HTML 页面、JavaScript 和 CSS 文件。
浏览器会自动处理由 gzip (gzipped) 压缩的内容,假设它们获得带有适当 HTTP 响应标头的正确压缩文件。
解决方案
有很多选项可以提供 gzip 压缩内容,例如,
.htaccess
或 PHP 脚本中)ob_gzhandler
或zlib.output-compression
)下一步
您的下一步可能是将所有这些文件合并为一个,以最大限度地减少 HTTP 请求。有很多工具可以自动执行此操作。
Background
Explanation
When you want to send a big file to your friend, you compress it using zip, rar, or other archiver like gzip to save some bytes and make it faster.
You may also do the same and compress HTML pages, JavaScript and CSS files.
Browsers do automatically handle content compressed by gzip (gzipped), assuming they get the properly compressed files with appropriate HTTP response headers.
Solutions
There are many options to serve gzipped content, e.g.
.htaccess
or PHP script)ob_gzhandler
orzlib.output-compression
)Next step
Your next step will be probably merging all those files into one, to minimize HTTP requests. There are many tools to do this automatically.
传统的方法是使用 ob_gzhandler。手册规定使用 zlib.output-compression< /a>,一个全局启用压缩的 php.ini 指令现在是首选。
The traditional way was to use ob_gzhandler. The manual stipulates that using zlib.output-compression, a php.ini directive that globally enables compression is preferred nowadays.