Thinkphp 关闭Gzip header输出有关问题

WBOY
Release: 2016-06-13 12:50:35
Original
811 people have browsed it

Thinkphp 关闭Gzip header输出问题
Thinkphp默认开启gzip压缩

'OUTPUT_ENCODE'         =>  true, // 页面压缩输出
Copy after login


需求是这样的
在一个Action里面,用header输出一个图片

问题
由于thinkphp使用了Ob_start
<br />
// 页面压缩输出支持<br />
        if(C('OUTPUT_ENCODE')){<br />
            $zlib = ini_get('zlib.output_compression');<br />
            if(empty($zlib)) ob_start('ob_gzhandler');<br />
        }<br />
Copy after login


导致如今的问题
<br />
if(C('OUTPUT_ENCODE')){<br />
        ob_flush();<br />
        ob_clean();<br />
      }<br />
 <br />
$thumburi = 'Thumb/666.jpg';<br />
    $type = getimagesize($thumburi);<br />
    header("Content-type: ".   $type['mime']);<br />
    readfile($thumburi);<br />
    die();<br />
Copy after login

无法用header输出图像,一整天了,仍然没有解决,哪位有高见解惑?
注:不能关闭页面压缩缓存!!

thinkphp? header
------解决方案--------------------
第三段代码是你自己写的么?
依然开启了 gzip 方式传递,那么你再改变传输类型,不是找抽吗?
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!