thinkphp development of a project, login successfully and then jump to the login page, in the submission of information after the output session is normal, no problem, but the page jump, session loss phenomenon, can not complete landing.
By looking for information, found that the original is the BOM header reason. With the restriction of the cookie delivery mechanism, the cookies cannot be delivered in the file with the BOM at the beginning of the file (because PHP has sent the file header before the cookie is sent out), so the login and logout functions fail. All the functionality that relies on cookies and session implementations is invalid.
The correct way is to remove some of the file BOM, the general situation is in the entry file BOM problem, I deal with the method is to open the file with notepad++, format selection to UTF-8 no BOM format, and then save, upload to the server. But it must be noted that the removal of the BOM upload to the server before the need to delete the source files on the server, upload cover can not remove the BOM.
After the BOM is removed, session cookie loss problem is resolved.
The above is a small set to introduce the PHP page jump session cookie loss caused by the problem can not be logged on, such as the solution, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!