A project developed by thinkphp. After successful login, it jumps to the login page. After submitting the information, the session output is normal and there is no problem. However, after the page jumps, the session is lost and the login cannot be completed normally.
After searching for information, I found out that it was the cause of the bom. 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.
The correct way to deal with it is to remove the BOM of some files. Generally, it is a BOM problem that occurs in the entry file. The way I deal with it is to open the file with Notepad++, select the format to encode in UTF-8 BOM-free format, then save and re- Just upload it to the server. But be sure to note that before removing the BOM and uploading it to the server, you need to delete the source files on the server. Uploading overwrite cannot remove the BOM.
After removing BOM, the problem of session cookie loss is solved.