gzip 与 codeigniter

发布于 2024-09-16 05:04:02 字数 59 浏览 3 评论 0原文

有没有办法用 codeigniter 进行 gzip 压缩?如果是,请分享库、插件或助手... 谢谢你!

Is there anyway to gzip with codeigniter? If yes please share Library, plugin or helper...
Thankyou!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

心房的律动 2024-09-23 05:04:02

在您的配置文件中,将 compress_output 更改为 TRUE。我认为它使用了gzip。

还有这样的免责声明:

非常重要:
如果启用压缩后出现空白页,则意味着
你过早地输出
一些东西到你的浏览器。它可以
甚至是一行空白
您的脚本之一的结尾。为了
压缩工作,没有什么可以
在输出缓冲区之前发送
由输出类调用。不要
通过压缩“回显”任何值
已启用。

In your config file change compress_output to TRUE. I think it uses gzip.

There's also this disclaimer:

VERY IMPORTANT:
If you are getting a blank page when compression is enabled it means
you are prematurely outputting
something to your browser. It could
even be a line of whitespace at the
end of one of your scripts. For
compression to work, nothing can be
sent before the output buffer is
called by the output class. Do not
"echo" any values with compression
enabled.

薆情海 2024-09-23 05:04:02

我在我的 网站 上遇到了同样的问题,但现在我已经通过应用以下步骤解决了这个问题

  1. :到 CI 的 config.php
  2. 找到此代码:$config['compress_output']
  3. 将值从 FALSE 更改为 TRUE:

$config['compress_output'] = TRUE;

现在您必须从服务器的php.ini 启用"zlib.output_compression"。您的前端不会收到错误。

I had the same issue on my site, but now I've figured it out by applying these steps:

  1. Go to CI's config.php:
  2. Find this code: $config['compress_output']
  3. Change value from FALSE to TRUE:

$config['compress_output'] = TRUE;

Now you have to enable "zlib.output_compression" from your server's php.ini. You will not receive error on your front-end.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文