note 17149 added to function.include

From: Date: Tue, 27 Nov 2001 22:30:51 +0000
Subject: note 17149 added to function.include
Groups: php.notes 
Request: Send a blank email to php-notes+get-21353@lists.php.net to get a copy of this message
When using include files it is important to note that global variables do not fit into the scope of a included file...only the file that is calling the include will have access to global variables (primarily enviroment & system variables like $HTTP_REFERER)! I found it best to think of a include file as a completely separate php script. With it's own variable scope. TIP: You can pass your include files variables via the query string! BASIC EXAMPLE: $referer = explode("/",getenv("HTTP_REFERER")); include("includefile.inc?referer=".$referer[2]); ### INCLUDEFILE.INC CONTENTS BELOW ### if( $referer == "www.foo.com" ) print "Welcome foo!"; else return; -- http://www.php.net/manual/en/function.include.php http://master.php.net/manage/user-notes.php?action=edit+17149 http://master.php.net/manage/user-notes.php?action=delete+17149 http://master.php.net/manage/user-notes.php?action=reject+17149

« previous php.notes (#21353) next »