Re: Getting path of script

From: Date: Tue, 13 Mar 2001 20:13:17 +0000
Subject: Re: Getting path of script
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-43707@lists.php.net to get a copy of this message
Hi, Thanks for all the suggestions. I worked out a fix in the meantime: $path = strstr(strrev($SCRIPT_FILENAME), '/'); echo strrev($path); Cheers, Jord On Tuesday 13 March 2001 12:35, you wrote: > check out, > dirname() // Returns directory name component of path > > py > > ----- Original Message ----- > From: Hardy Merrill <merrill@missioncriticallinux.com> > To: Jordan Elver <jjelver@worldsites.net> > Cc: <php-general@lists.php.net> > Sent: Tuesday, March 13, 2001 5:21 PM > Subject: Re: [PHP] Getting path of script > > > How 'bout using a Perl regex with $HTTP_SERVER_VARS["SCRIPT_NAME"] > > like this: > > > > echo "Starting with SCRIPT_NAME=[" . > > $HTTP_SERVER_VARS["SCRIPT_NAME"] > > . > > "]<BR>"; > > > if (preg_match("/(\S+)\/\S+$/", $HTTP_SERVER_VARS["SCRIPT_NAME"], > > $matches)) { > > > echo "Found $matches[1]<br>"; > > } > > > > HTH. > > > > -- > > Hardy Merrill > > Mission Critical Linux, Inc. > > http://www.missioncriticallinux.com > > > > Jordan Elver [jjelver@worldsites.net] wrote: > > > Hi, > > > I want to get the path of a script. I know about > > > HTTP_SERVER_VARS["SCRIPT_FILENAME"] this returns someting like: > > > > > > /phpcode/misc/phpinfo.php > > > > > > But I want to strip off the file name and just have the directory path, > > like: > > > /phpcode/misc/ > > > > > > Any ideas? > > > > > > Jord > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > > For additional commands, e-mail: php-general-help@lists.php.net > > > To contact the list administrators, e-mail: > > > php-list-admin@lists.php.net > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#43707) next »