> hai ..
>       if u r seeing http://www.google.com/blog/myblog.php
> then
>       $_SERVER[SERVER_NAME] would give u www.google.com
> and
>       $_SERVER[PHP_SELF] would give u /blog/myblog.php

PHP_SELF also gives the PATH_INFO and QUERY_STRING of the script, which
can make it problematic to determine the exact script name:


would give

for PHP_SELF, when in liklihood you're looking for


If using Apache, use SCRIPT_NAME as the $_SERVER key -- this gives just
the path to the script - no PATH INFO, no QUERY_STRING. 

There are some regexps/functions floating around out there to remove
PATH_INFO and QUERY_STRING from PHP_SELF as well, and this may be more
portable than SCRIPT_NAME as not all httpd servers use it.

> On Sat, 6 Aug 2005, Ron Piggott wrote:
> > What is the correct $_SERVER that tells me what page is currently being
> > displayed?  Ron

Matthew Weier O'Phinney
Zend Certified Engineer

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to