In the process of writing PHP files, found in the browser preview PHP files, the top will appear a line of blank, affecting the layout of the page.
the explanation of the BOM header is as follows:
Typically, you write a Web program using a notepad program that comes with your Windows system, but after you write or modify your PHP blog system code, you always get the following questions as you debug:
– Cannot log in or be logged out;
– A blank appears at the top of the page;
– An error warning appears at the top of the page;
– Other abnormal conditions.
Analysis Reason:
Because UTF-8 encoding is used, it is saved in the Utf-8 encoding format after the code is written or modified. Although almost all of the text editing software now can display and edit UTF-8 encoded files, unfortunately many of these software performance is not ideal.
Software such as Windows-brought Notepad, when saving a UTF-8 encoded file, inserts three invisible characters (_0xef _0xbb _0xbf, Bom--byte Order Mark) 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, PHP at design time does not consider the problem of the BOM, do not ignore the UTF-8 encoded file at the beginning of the BOM three characters, will be the BOM as part of the text at the beginning of the file. Because of the need to
Solutions:
When editing or changing any text file, be sure to use an editor that does not mess with the BOM. The editor under Linux should not have this problem. Under Windows, do not use editors such as Notepad. The recommended editors are:
EditPlus version 2.12 or above;
EmEditor;
UltraEdit (need to cancel the ' Add BOM ' option);
Dreamweaver (need to cancel the ' Add BOM ' option);
Notepad (needs to be "converted to UTF-8 without BOM") and so on.
For a file that has already been added to the BOM, you can save it with the above editor if you want to cancel it. (EditPlus needs to be saved as GB first and then saved as UTF-8.) Dreamweaver "contains Unicode signature (BOM)" Cancellation in Page properties
http://www.bkjia.com/PHPjc/326364.html www.bkjia.com true http://www.bkjia.com/PHPjc/326364.html techarticle In the process of writing PHP files, found in the browser preview PHP files, the top will appear a line of blank, affecting the layout of the page. The explanation of the BOM header is as follows: Usually, to make ...