note 62043 added to function.basename
| From: | lazylester at osu1 dot php dot net | Date: | Sat, 18 Feb 2006 00:19:19 +0000 |
| Subject: | note 62043 added to function.basename | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-103953@lists.php.net to get a copy of this message | ||
If your path has a query string appended, and if the query string contains a "/"
character, then the suggestions for extracting the filename offered below don't work.
For instance if the path is like this:
http://www.ex.com/getdat.php?dep=n/a&title=boss
Then both the php basename() function, and also
the $_SERVER[QUERY_STRING] variables get confused.
In such a case, use:
<php
$path_with_query="http://www.ex.com/getdat.php?dep=n/a&title=boss";
$path=explode("?",$path_with_query);
$filename=basename($path[0]);
$query=$path[1];
?>
----
Server IP: 64.71.164.2
Probable Submitter: 67.169.85.41
----
Manual Page -- http://www.php.net/manual/en/function.basename.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+62043
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+62043&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+62043&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+62043&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+62043&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+62043&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+62043&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+62043&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+62043&report=yes
Search -- http://master.php.net/manage/user-notes.php