Prompt for applying ob_flush: E_WARNING: Cannotmodifyheaderinformation

Source: Internet
Author: User
Use ob_flush prompt: E_WARNING: Cannotmodifyheaderinformation use ob_flush prompt: E_WARNING: & nbsp; Cannot & nbsp; modify & nbsp; header & nbsp; information & nbsp;-& nbsp; headers & nbs use ob_flush prompt: E_WARNING: Cannot modify header information
Use ob_flush prompt: E_WARNING: Cannot modify header information-headers already sent
How can this problem be solved?

The code is as follows:
Echo $ show_msg. "script" $ script "";
Ob_flush ();
Flush (); share:
------ Solution --------------------
The error message is clearly written, and the response header has been output, so you cannot modify the header information.

It should be because you did not open a new ob and directly output the data (with the response header output at the same time). by default, the data is directly sent to the browser.

When ob is used, the data is first written in ob, and then the content in ob is output.
------ Solution --------------------

function flush_buffers(){ 
    ob_end_flush(); 
    ob_flush(); 
    flush(); 
    ob_start(); 
} 

------ Solution --------------------
Unless a syntax error occurs, nothing can be done before the #10 code!
However, an error may occur when header, session_start, and setcookie are added.

You 'd better post the complete error message

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.