代码之家  ›  专栏  ›  技术社区  ›  Tim Lytle

CodeIgniter项目给出303/压缩错误

  •  7
  • Tim Lytle  · 技术社区  · 15 年前

    试图为本地开发(LAMP stack)设置一个基于CodeIgniter的项目,一旦更新了所有配置文件(这意味着我成功地为CodeIgniter设置了有意义的引导错误),我在浏览器中会遇到以下错误:

    • 火狐

    只需使用wget获取文件就可以了,没有错误,而且我得到了我期望的内容。不确定这是CI和服务器的问题,还是项目的问题。 有人见过这个吗?

    4 回复  |  直到 15 年前
        1
  •  10
  •   Pekka    15 年前

    CodeIgniter似乎有自己的gzip输出方法(为什么,我不知道,但我不太熟悉CI)

    this forum entry ,当PHP错误消息将压缩内容搞砸时,可能会发生这样的错误。调整错误报告到 E_ALL ^ E_NOTICE

    更新:似乎还有一个CI配置设置:

    $config['compress_output'] = FALSE;
    
        2
  •  5
  •   Prix Winteroo    10 年前

    我不确定我的评论是否有价值,但我有一个类似的问题,我想和你们分享,谁知道它可能会帮助你们中的一些人。

    $config['compress_output'] = TRUE;
    

    在配置文件中,可以很好地说:

    | Enables Gzip output compression for faster page loads.  When enabled,
    | the output class will test whether your server supports Gzip.
    | Even if it does, however, not all browsers support compression
    | so enable only if you are reasonably sure your visitors can handle it.
    |
    | 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.
    |
    */
    

    但是,我的函数需要为我的Ajax调用回显一个json编码的数组。

    为了解决这个问题,我在“echo”之后添加了“exit”函数。

        echo json_encode($arr_ajaxResults);
        exit();
    

        3
  •  0
  •   user181799 user181799    12 年前

    对于IIS用户来说,检查PHP管理器日志中的错误是很有用的。

        4
  •  0
  •   strah    12 年前

    文本编辑器通常使用ascii编码,我用notepad++打开文件并将页面编码更改为: utf-8 without BOM . 现在页面运行良好。