PHP in the header after the execution of no output, how to solve
Source: Internet
Author: User
No output after header execution in PHP
$TESTSTR = "AAA";
$TESTSTR = "CCCCCCCCC";
Header ("http/1.1 304 not Modified");
Echo $testStr;
?>
Why my code will not output
------Solution--------------------
You don't know what 304 means?
304 means the body is the same as "last", only the header, not the body, usually used in response to the client refresh (that is, a short time before the send)
------Solution--------------------
304 can reduce the server a lot of traffic, but used in the program to "last" judge accurate, grasp the time period is not easy
------Solution--------------------
For dynamic page cache acceleration, first add the last Modified definition in the HTTP Header of Response, followed by the If Modified Since and the requested content update time in request to return 200 or 304. Although the database query has been done at the time of return 304, but can avoid the next more database query, and do not return the page content and just an HTTP Header, thereby greatly reducing the bandwidth consumption, the user's feeling is also improved.
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.