|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-02-12 08:41 UTC] dante dot lorenso at atmosenergy dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 17 21:00:01 2025 UTC |
If I try to set or unset a session variable by using the $_SESSION method of session handling, before using a 'header("Location: /xyz");' redirect, the session variable modification is not saved. I've tried to use a 'flush()' a 'session_write_close()' and 'exit;'...nothing seems to help. class A { /* CONSTRUCTOR */ function A() { session_start(); } /* works */ function foo() { $_SESSION["AUTH"] = "Dante"; } /* does NOT work */ function bar() { $_SESSION["AUTH"] = ""; header("Location: http://www.yahoo.com/"); // flush(); // session_write_close(); // exit; } /* does NOT work */ function bar2() { unset($_SESSION["AUTH"]); header("Location: http://www.yahoo.com/"); } } //---------- /* file1.html $a = new A(); $a->foo(); // works //---------- /* file2.html $a = new A(); $a->bar(); // fails //---------- /* file3.html $a = new A(); $a->bar2(); // fails