Tip: Users who use UTF-8 encoding should not use Notepad to edit code files and template files. Use tools that can remove Unicode signatures (BOM) for editing. If your website opens blank, styles are lost, and program errors are reported, it is likely that you have used a tool that failed to remove BOM to modify the template file or source code file.
Nearly all text editing software now can display and edit UTF-8 encoded files. But unfortunately, many of them don't perform well.
Software such as Notepad that comes with WINDOWS will insert three invisible characters (0xEF 0xBB 0xBF, or BOM) at the beginning of the file when saving a file encoded in UTF-8. 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, 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 (the related options of 'Add BOM' need to be canceled); Dreamweaver (the related options of 'Add BOM' need to be canceled), etc.
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.)
You can remove the Unicode signature (BOM) in Dreamweaver, click Modify->Page Properties in the menu bar, or directly press the Ctrl+J shortcut key.