How can I clear my php session data correctly?

后端 未结 3 779
离开以前
离开以前 2020-12-11 16:44

My php website flows like this:

  • Page1.php has an html form which POSTs to Page2.php
  • Page2.php stores all the POST data into SESSION variables and has
3条回答
  •  暖寄归人
    2020-12-11 17:00

    Use session_unset(). Like this:

    
    
      
        ' . "\n";
          print_r($_SESSION);
          print '    
    ' . "\n"; session_unset(); print '
    ' . "\n";
          print_r($_SESSION);
          print '    
    ' . "\n"; ?>

    This would output:

    Array
    (
    variabletounset => I am going to be unset soon along with all of the other session variables.
    )
    
    Array
    (
    )
    

提交回复
热议问题