PHP page Jump session cookie loss resulting in problems such as unable to login and other solutions

Source: Internet
Author: User
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.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.