|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-01-05 21:52 UTC] 247net at gmx dot net
<?
function func1(){
echo "Set iVar<br>";
$_SESSION["iVar"] = 8;
}
function func2(){
echo "\$_SESSION[iVar] ".$_SESSION[iVar]."<br>";
}
session_start();
if ($_REQUEST["action"] != "page2"){
func1();
}
func2();
if (session_is_registered("iVar") == FALSE){
echo "iVar is not registered<br>";
}
echo "<a href='$PHP_SELF?action=page1'>page1</a><br>";
echo "<a href='$PHP_SELF?action=page2'>page2</a><br>";
?>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 03:00:01 2025 UTC |
<? session_start(); $_SESSION["foo"] = "bar"; if (session_is_registered("foo") == FALSE){ echo "foo is not registered<br>"; }else{ echo $_SESSION["foo"]; } ?>I've looked at the (updated) documentation. --snip If you are using $HTTP_SESSION_VARS/$_SESSION, do not use session_register(), session_is_registered() and session_unregister() unless you know internal of session module. --snap that's it! thx yohgaki btw. the following works session_start(); $_SESSION["foo"] = "foo is registered"; if ($_SESSION["foo"]){ echo $_SESSION["foo"]; }else{ echo "foo is not registered<br>"; }I am running 4.2.0-dev also and $_SESSION is not stored properly i.e. not accessible after it has been set. e.g. <? session_start(); if ($_SESSION["foo"]){ echo $_SESSION["foo"]; }else{ echo "foo is not registered<br>"; $_SESSION["foo"] = "foo is registered"; } ?> so first time through, it should set it - subsequent reloads it should be already set?