thinkphp closing the GZIP header output issue

Source: Internet
Author: User
thinkphp gzip compression is turned on by default
' Output_encode '         =  true,//page compression output


The demand is like this
In an action, use the header to output a picture

Problem
Because thinkphp used the Ob_start
The page compression output supports        if (C (' Output_encode ')) {            $zlib = ini_get (' zlib.output_compression ');            if (empty ($zlib)) Ob_start (' Ob_gzhandler ');        }


Cause today's problems
if (C (' Output_encode ')) {        ob_flush ();        Ob_clean ();      } $thumburi = ' thumb/666.jpg ';    $type = getimagesize ($thumburi);    Header ("Content-type:".   ) $type [' MIME ']);    ReadFile ($thumburi);    Die ();

Unable to output the image with the header, all day long, still no solution, who has the insight?
Note: You cannot turn off page compression caching!!


Reply to discussion (solution)

Did you write the third piece of code yourself?
Still turned on the gzip mode pass, then you change the transmission type, not to find the smoke?


And you've opened the gzip? The function of OB is really dizzy, so how do I close this section?

Did you write the third piece of code yourself?
Still turned on the gzip mode pass, then you change the transmission type, not to find the smoke?

And you've opened the gzip? The function of OB is really dizzy, so how do I close this section?

No workaround was found and finally closed the grouped page compression cache.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.