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 [[EMAIL PROTECTED]] 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]