Recently encountered page under Chrome, there is a blank question at the top. Later know is the problem of BOM head.
1. What is a BOM header?
The BOM signature means to tell the editor what encoding the current file is for easy editor identification, but the BOM does not appear in the editor, but produces output, just like a blank line. The generic encoding set does not appear in the BOM header, which appears in the Unicode encoding set.
Software such as Windows-brought Notepad, when saving a UTF-8 encoded file, inserts three invisible characters (0xEF 0xBB 0xBF, or BOM) where the file begins. It is a string of hidden characters that allows editors such as Notepad to identify whether the file is encoded in UTF-8. For general files, this does not cause any trouble. But for PHP, BOM is a big hassle.
PHP does not ignore the BOM, so when you read, include, or reference these files, the BOM is used as part of the text at the beginning of the file. Depending on the characteristics of the embedded language, this string of characters will be executed directly (shown). This results in even if the top padding of the page is set to 0,
can't keep the entire page close to the top of the browserBecause there are 3 characters at the beginning of the HTML! Reference: HTTP://BLOG.SINA.COM.CN/S/BLOG_6EC912D80101BTCL.HTML2. Workaround
A. EditPlus to the BOM head method
After the editor is resized to UTF8 encoded format, the saved file will be preceded by a string of hidden characters (also known as BOMs), used by the editor to identify whether the file is encoded in UTF8.
RunEditPlusClickToolsChooseparameter SettingsSelectedfile, the default encoding is Utf-8. or save file as, encoding selects Utf-8.
B. Notepad removal of BOM head approach
After opening the file, select Utf-8 no BOM format encoding in the encoding, OK.
Do not accumulate Kuibu not even thousands of miles, refueling
A blank address appears at the top of the page in the Chrome browser