note 85021 added to book.session

From: Date: Mon, 11 Aug 2008 11:54:24 +0000
Subject: note 85021 added to book.session
Groups: php.notes 
Request: Send a blank email to php-notes+get-143357@lists.php.net to get a copy of this message
Persistence of session data in included file also has one more aspects if you are including a file using/over the http connection. Session will not be available without refresh (it's a separate thread even if you are on the same domain/server), which is again a correct behavior, but if you are including a file from local file system then it should have session data if you are setting and accessing the $_SESSION variable even before page refresh because it is available globally. [code] session_start(); $_SESSION['example']="yes"; Include("otherfile"); [/code] Session variable will be available in included file. [code] session_start(); $_SESSION['example']="yes"; Include("http://domain.com/otherfile.php"); [/code] Session will NOT be available in other file. BUt if both files are on same server then after refresh values will be available. ---- Server IP: 59.162.86.33 Probable Submitter: 203.122.11.35 ---- Manual Page -- http://www.php.net/manual/en/book.session.php Edit -- https://master.php.net/note/edit/85021 Del: integrated -- https://master.php.net/note/delete/85021/integrated Del: useless -- https://master.php.net/note/delete/85021/useless Del: bad code -- https://master.php.net/note/delete/85021/bad+code Del: spam -- https://master.php.net/note/delete/85021/spam Del: non-english -- https://master.php.net/note/delete/85021/non-english Del: in docs -- https://master.php.net/note/delete/85021/in+docs Del: other reasons-- https://master.php.net/note/delete/85021 Reject -- https://master.php.net/note/reject/85021 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#143357) next »