What is a php bom?

王林
Release: 2023-03-01 19:08:01
Original
2966 people have browsed it

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.

What is a php bom?

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!

Related labels:
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!