Click to See Complete Forum and Search --> : [RESOLVED] How to Get Only the File Name From the Current URL??


Shanu.chaudhary
04-19-2008, 03:45 AM
Hi....

I am posting several questions..But til now I didnt get even a single answer to any one of those.......:( :( I dont know the reason....

Still Hope remains in me and posting new one....

Plz giv me the Solution......

How can I get only the FileName of the Current URL???


Thanks a lot in Advance.....I need solution to this....Even thought it wont work it doesn't matter.....:p

Hope i will get a solution.....:D

Fang
04-19-2008, 05:27 AM
http://nl3.php.net/basename

Shanu.chaudhary
04-19-2008, 05:54 AM
Thanks a lot...

But my url contains something like this.....index.php?page=2&order=L

In this case how can I get only the file name as "index.php"

Fang
04-19-2008, 06:19 AM
<?php
$url = "http://www.myweb.com/cgi-bin/sales.pgm?vendor=1234&user=robin&po=1000";
$fileName= explode(".", basename($url));
echo $fileName[0];
?>

Shanu.chaudhary
04-19-2008, 06:21 AM
Thanks a lot....:) :)