简体   繁体   中英

PHP session variables lost after redirect

Session variables are lost after using the following code to redirect:

    header('Location: ./protected_page.php');
    exit; //doesn't seem to do anything

On protected page I make sure to use session_start() before referencing any session variables.

Please help!

  • You redirect to the same domain.If you are redirecting from www.thedomain.com to thedomain.com can possibly end you session

  • Ensure register_globals is off, you can check this on the php.ini file and also using phpinfo().

  • The session variables aren't overwritten.

  • switching between http and https can also end your session.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM