thinkphp development of a project, login success and then jump to the login page, after the submission of information after the output session is normal, no problem, but the page after the jump, the session lost phenomenon, unable to complete the landing.
Find out the reason for the BOM header by finding the data. Limited by the cookie-sending mechanism, where the file has a BOM at the beginning of these files, the cookie cannot be sent out (because PHP has sent the file header before the cookie is sent), so the login and logout functions fail. All the functions that rely on cookies and session implementations are not valid.
The correct way is to remove some of the file BOM, the general situation is in the import file BOM problem, I deal with the method is to open the file with notepad++, format selection to UTF-8 no BOM format encoding, and then save, re-upload to the server. However, it is important to note that removing the BOM before uploading to the server needs to delete the source files on the server, upload overlay can not remove the BOM.
When the BOM is removed, the session cookie problem is resolved.