gzip 压缩 utf-8 编码的 php 页面时出现问题。帮助!
我在我的 php 页面顶部使用它:
if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip'))
ob_start("ob_gzhandler");
else
ob_start();
当使用 ANSI 编码保存页面时,页面被压缩。但是当我将页面编码更改为 utf-8 时,压缩失败。请帮忙!!!
我在 www.gidnetwork.com/tools/gzip-test.php 上测试压缩
i use this at top of my php page:
if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip'))
ob_start("ob_gzhandler");
else
ob_start();
when page is save with ANSI encoding page was compressed. but when i change page encoding to utf-8 compression was faild. please help!!!
i test compression on www.gidnetwork.com/tools/gzip-test.php
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据猜测,当您保存时,您在 PHP 源文件中包含 BOM UTF-8 会破坏压缩流。确保以 UTF-8 无 BOM 格式保存文件。
By guess is that you are including a BOM in your PHP source file when you save in UTF-8 and that's corrupting the compressed stream. Make sure you save in the file in UTF-8 without BOM.