Home >Backend Development >PHP Problem >What is a php bom?
The bom header is a string of hidden characters used to allow editors such as Notepad to identify whether the file is encoded in UTF-8. PHP will not ignore BOM, so when reading, including or referencing these files, BOM will be used as part of the beginning text of the file.
bom introduction
bom is a string of hidden characters, which is used to allow editors such as Notepad to identify whether the file is UTF-8 encoding.
When software such as Notepad that comes with Windows saves a file encoded in UTF-8, three invisible characters (0xEF 0xBB 0xBF) will be inserted at the beginning of the file, that is, BOM).
PHP does not ignore the BOM, so when reading, including or referencing these files, the BOM will be used as part of the beginning text of the file. According to the characteristics of embedded languages, this string of characters will be executed (displayed) directly. This causes the problem that even if the top padding of the page is set to 0, the entire web page cannot stick to the top of the browser.
If the window editor saves it as a utf8 file, it will add a BOM header for you to tell other editors to display characters in utf8. However, there is no need to add BOM header recognition on the web page, because the head header can be used on the web page to specify charset=utf8 and tell the browser to use utf8 for interpretation.
For more related knowledge, please visit php Chinese website.
The above is the detailed content of What is a php bom?. For more information, please follow other related articles on the PHP Chinese website!