RE: [PHP-WIN] Hoe to get file name?
| From: | Nold, Mark | Date: | Fri, 27 Oct 2000 07:04:13 +0000 |
| Subject: | RE: [PHP-WIN] Hoe to get file name? | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-3548@lists.php.net to get a copy of this message | ||
----------------------------------------------------------------------------
-----------------
Disclaimer: The information contained in this email is intended only for the
use of the person(s) to whom it is addressed and may be confidential or
contain legally privileged information. If you are not the intended
recipient you are hereby notified that any perusal, use, distribution,
copying or disclosure is strictly prohibited. If you have received this
email in error please immediately advise us by return email at
postmaster@normandy.com.au and delete the email document without making a
copy.
----------------------------------------------------------------------------
-----------------
Maybe you should use basename()
$URL="http://www.domanname.com/scripts/test/phpscript.php?foo=bar&mew=2";
echo basename($URL);
You will probably still need to strip GET vars if they are there.
mn
-----Original Message-----
From: Gonzalo Vera [mailto:gvz@eucalipto.net]
Sent: Friday, October 27, 2000 5:25 AM
To: afan
Cc: php-windows@lists.php.net
Subject: Re: [PHP-WIN] Hoe to get file name?
How about (untested):
$parts=explode("/",$url);
$file=$parts[sizeof($parts)];
This should return the last exploded element from $url, after the last
"/". Would it work?
Gonzalo.
> Hi all,
> $HTTP_REFERER willl show complete URL.
> $PATH_INFO will show part after server name ($SERVER_NAME).
> $QUERY_STRING - string after sign "?" in URL.
> But, how to get file name from URL
> (i.g. in
> URL="http://www.domanname.com/scripts/test/phpscript.php"
> I need
extract phpscript.php)
> Thanks!