No output after the header is executed in php

Source: Internet
Author: User
Php header is not output after execution

$ TestStr = "aaa ";
$ TestStr = "ccccccccc ";
Header ("HTTP/1.1 304 Not Modified ");
Echo $ testStr;
Why is my code not output?

Reply to discussion (solution)

You don't know what 304 means?

304 indicates that the body is the same as the "last", and only the header is sent without the body. it is usually used in the response to the client refresh (that is, it was sent once before a short time)

304 can reduce a lot of server traffic, but it is not easy to accurately determine the last time in the program and grasp the time period.

For dynamic page Cache Acceleration, first add the Last Modified definition to the HTTP Header of Response, and then return 200 or 304 according to the If Modified Since in the Request and the update time of the requested content. Although a database query has been performed when 304 is returned, more database queries can be avoided, and no page content is returned, instead of an HTTP Header, this greatly reduces bandwidth consumption and improves user experience.

Thank you for your answers. I am working on etag. I have answered all the answers. The problem has been solved.

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: 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.