note 54084 modified in function.session-id by bjori

From: Date: Fri, 02 Jun 2006 06:35:09 +0000
Subject: note 54084 modified in function.session-id by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-112887@lists.php.net to get a copy of this message
About the note from Cybertinus : The following test doesn't work, the code following is always executed : if(!session_id()) { // Always executed even if there's already an opened session } session_id() returns an empty string if there is no current session, so to test if a session already exists, it's better to write this : if(session_id() == "") { session_start(); } else { // Anything you want } --was-- About the note from Cybertinus : The following test doesn't work, the code following is always executed : if(!session_id()) { // Always executed even if there's already an opened session } session_id() returns an empty string if there is no current session, so to test if a session already exists, it's better to write this : if(session_id() == "") { start_session(); } else { // Anything you want } http://php.net/manual/en/function.session-id.php

« previous php.notes (#112887) next »