PHP sessions destroy across sub domains

前端 未结 1 883
谎友^
谎友^ 2021-01-17 05:02

This could be the sequel of this question: PHP Sessions across sub domains

I have a successful multi-domain session simply using this:

session_set_co         


        
相关标签:
1条回答
  • 2021-01-17 05:48

    Did you see if the session is started before you try to destroy it?

    if (!isset($_SESSION)) session_start();
    if (isset($_COOKIE['auth_token'])) {
    remove_token($_COOKIE['auth_token']);
    setcookie("auth_token", "", time()-3600, "/", ".domain.com");
    }
    session_destroy();
    

    This is working code from my environment. Hope it helps.

    0 讨论(0)
提交回复
热议问题