Re: Which file "Included" me?

From: Date: Wed, 18 Feb 2009 18:53:24 +0000
Subject: Re: Which file "Included" me?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-288560@lists.php.net to get a copy of this message
Michael A. Peters wrote: > Ed Curtis wrote: >> Is there a function or variable that will tell me if a file has asked >> another file to include something much the same as >> $_SERVER['HTTP_REFERER'] works. I have a script that is included on >> every page of a site but also needs to include some javascript only if >> it's called from a certain URL. >> >> thanks, >> >> Ed >> > > $_SERVER['PHP_SELF'] As Rob pointed out, $_SERVER['REQUEST_URI'] will give you the URI whereas $_SERVER['PHP_SELF'] will only give the path and script name. For: http://localhost/www/test.php?var=val $_SERVER['PHP_SELF'] = /www/test.php $_SERVER['REQUEST_URI'] = /www/test.php?var=val -- Thanks! -Shawn http://www.spidean.com

« previous php.general (#288560) next »