Home > Backend Development > PHP Tutorial > The impact of bom_PHP tutorial

The impact of bom_PHP tutorial

WBOY
Release: 2016-07-13 17:36:35
Original
882 people have browsed it

The following error occurred when setting cookie.

Cannot modify header information - headers already sent by ....

This error is very common. If any text content is output before setcookie, the above error message will appear. Since several files are required at the top of the page, it is very troublesome to check them line by line. Therefore, I added:

at the top of the page.

PLAIN TEXT
PHP:
ob_start();
Add code before setcookie:

PLAIN TEXT
PHP:
ob_get_clean();
This is to get the content output by the page before setcookie. After the page is run, an empty string is displayed and output, that is, there is no output before setcookie.

Then I opened the source file with vim and found that vim had the bomb option turned on. I suspected that a hidden string was added to the code, so I closed it:

set nobomb

Problem solved.

What does BOM mean?
BOM is the abbreviation of "Byte Order Mark", which is used to mark the encoding of files. Not all text editing tools recognize BOM tags

Author: volcano Published on February 28, 2008 at 8:16 pm

Copyright information: You can reprint at will. When reprinting, please be sure to indicate the original source and author information of the article and this statement in the form of a hyperlink

Permanent link - http://www.ooso.net/index.php/archives/378

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/486643.htmlTechArticleThe following error occurred when setting cookie. Cannot modify header information - headers already sent by .... This error is very common, if any text is output before setcookie...
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