Re: getting a filename [with no extension] out of a url

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Richard Davey wrote:
Hello Graham,

Friday, July 1, 2005, 12:54:42 AM, you wrote:

GA> if  $_SERVER['SCRIPT_NAME'] give this....
GA> /folder/folder/Library/php/filename.php

$_SERVER['SCRIPT_NAME'] won't give you that,
$_SERVER['SCRIPT_FILENAME'] would.

SCRIPT_NAME would just give you /filename.php

And if you need to remove the slash at the start, pick any of the
following: substr, str_replace, preg_replace, strpos, etc.

echo basename($_SERVER['SCRIPT_FILENAME'],'.php')

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux