Tip: Do not use NotePad to edit the code file and template file, use a tool that can remove the Unicode signature (BOM) edit. If your website is blank, the style is lost, and the program reports an error, you may have used the tool that failed to remove BOM to modify the template file or source code file.
Now, almost all text editing software can display and edit UTF-8-encoded files. However, unfortunately, many of them are not doing well.
Similar to WINDOWS notepad and other software, when saving a file encoded in UTF-8, it inserts three invisible characters (0xEF 0xBB 0xBF, BOM) at the beginning of the file ). It is a string of hidden characters, used for the notepad editor to identify whether the file is encoded in UTF-8. For general files, this will not cause any trouble. However, BOM is a big headache for PHP.
PHP does not ignore the BOM. Therefore, when reading, including, or referencing these files, the BOM is used as part of the Beginning body of the file. According to the characteristics of the embedded language, this string of characters will be directly executed (displayed. As a result, even if the top padding of the page is set to 0, the whole web page cannot be placed close to the top of the browser, because there are three characters at the beginning of html!
This is not the biggest problem. Due to restrictions of the COOKIE sending mechanism, Cookies cannot be sent to files with BOM at the beginning of these files (because PHP has already sent the file header before the COOKIE is sent ), therefore, the logon and logout functions are invalid. All functions dependent on cookies and sessions are invalid.
Therefore, when editing or changing any text files, you must use an editor without adding BOM. The editor in Linux should have no such problem. In WINDOWS, do not use notepad or other editors. Recommended editors are: Editplus version 2.12 and later; EmEditor; UltraEdit (options related to 'add BOM 'need to be removed); Dreamweaver (options related to 'add BOM' need to be removed.
If you want to cancel a file that has been added with BOM, you can use the editor above to save it again. (Editplus needs to be saved as gb first, then as UTF-8 .)
In Dreamweaver, you can remove the Unicode signature (BOM), click Modify in the menu bar-> page attribute, or press Ctrl + J.