note 58075 deleted from function.session-destroy by philip
| From: | philip@php.net | Date: | Wed, 29 Mar 2006 06:11:39 +0000 |
| Subject: | note 58075 deleted from function.session-destroy by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-106908@lists.php.net to get a copy of this message | ||
Note Submitter: visonardo
----
in the manual says: when you use (or declared) a session var with $_SESSION you dont need to use
session_register and when you want to
well, a little note about it is follow:
<?php
session_start();
$item=$_SESSION['item'];
[............]
if(isset($_GET['salir']))
{
//session_unset(); to see that I (now) dont use session_unset() to destroy a session vars....
session_destroy();
?>
Since here, it has been destroy the session but not the variables, BUT when I use this page again
and is executed the session_destroy() now yes :| !! it destroy all globals variables of my last
session. It means that I need
1- destroy the session (not their vars)
2- when I run this script again without use session var (just like is in this script) it will
destroy the session vars, and note that it did the session destroy.
3- I tried too put it thus:
[.........]
if(isset($_GET['salir']))
{
//session_unset();
session_destroy();
session_destroy();
}
Obviously, it showed me an error message "Warning: session_destroy()
[function.session-destroy]: Trying to destroy uninitialized session in W:\www\carrito\changuito.php
on line xx"
Then, I cant use two time thus.
since here, I didnt use session_unset neither $_SESSION=array();
Other thing, in this manual says: if you use $_SESSION dont use session_unset(), you should use ...
$_SESSION=array();
well, it dont work in my script, but yes when I use session_unset();
NOTE: all it with php 5.0.4 and win2k