session_unregister() only make effact in situation when register_global is set On.
That is to say if u use $_SESSION['name'] to get the variable, this function will be useless.

解决方案 »

  1.   

    If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use session_register(), session_is_registered() and session_unregister(). 
      

  2.   

    If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use session_register(), session_is_registered() and session_unregister(). from php manual
      

  3.   

    请正面回答我的问题,我知道如果用$_SESSION就不用session_register(),可是我现在没用$_SESSION,而是在用session_register()
      

  4.   

    如果你有一下session为$aaa
    那就用session_unregister("aaa");
      

  5.   

    <?
    //test.php
    session_start();
    session_register('name');
    $name="uGain";
    echo '<a href=test2.php>test</a>';
    ?><?
    //test2.php
    session_start();
    session_unregister('name');//value of $name already in the page,session_register() only empty the value of $name in session.
    echo $name;
    echo '<br><a href=test3.php>test3</a>';
    ?><?
    //test3.php
    session_start();
    echo $name;
    ?>
    session_unregister()
    This function doesn't unset the corresponding global variable for name, it only prevents the variable from being saved as part of the session. You must call unset() to remove the corresponding global variable.