PHP ending sessions(different ways) i dont understand

后端 未结 2 917
轻奢々
轻奢々 2020-12-18 09:53

I\'m trying to understand sessions and how some of the functions to end them work. I\'ve gone to different sites/and even here on SO and, well essentially, nothing is workin

2条回答
  •  抹茶落季
    2020-12-18 10:17

    You have to start a session in order to end a session. I recommend taking a look at... http://php.about.com/od/advancedphp/ss/php_sessions_3.htm

    // you have to open the session to be able to modify or remove it 
    session_start(); 
    
    // to change a variable, just overwrite it 
    $_SESSION['size']='large'; 
    
    //you can remove a single variable in the session 
    unset($_SESSION['shape']); 
    
    // or this would remove all the variables in the session, but not the session itself 
    session_unset(); 
    
    // this would destroy the session variables 
    session_destroy(); 
    

提交回复
热议问题