If after you modify any PHP file:
You cannot log in or out;
A blank line appears at the top of the page;
An error warning appears at the top of the page;
Other abnormal situations.
It’s probably an editor problem.
This program uses UTF-8 encoding. Almost all text editing software now can display and edit UTF-8 encoded files. But unfortunately, many of them don't perform well.
Software like Notepad that comes with Windows, when saving a file encoded in UTF-8, will insert three invisible characters (0xEF 0xBB 0xBF, or BOM) at the beginning of the file. It is a string of hidden characters used to let editors such as Notepad identify whether the file is encoded in UTF-8. For ordinary files, this will not cause any trouble. But for PHP, BOM is a problem.
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. As a result, even if the top padding of the page is set to 0, the entire web page cannot be placed close to the top of the browser, because there are these 3 characters at the beginning of the html!
The biggest trouble is not this. Due to the limitations of the COOKIE sending mechanism, in files that already have a BOM at the beginning of these files, the COOKIE cannot be sent (because PHP has already sent the file header before the COOKIE is sent), so the login and logout functions are invalid. All functions that rely on COOKIE and SESSION are invalid.
Therefore, when editing or changing any text file, please be sure to use an editor that does not add BOM randomly. Editors under Linux should not have this problem. Under WINDOWS, please 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' related options);
Dreamweaver (need to cancel the 'Add BOM' related options)
Wait.
For files that have added BOM, if you want to cancel, you can use the above editor to save it once. (Editplus needs to save as gb first, then save as UTF-8)