You are here: Re: [PHP] getting a filename [with no extension] out of a url « PHP « IT news, forums, messages
Re: [PHP] getting a filename [with no extension] out of a url

Posted by Tom Rogers on 07/01/05 03:09

Hi,

Friday, July 1, 2005, 9:54:42 AM, you wrote:
GA> if $_SERVER['SCRIPT_NAME'] give this....
GA> /folder/folder/Library/php/filename.php

GA> what would be the proper way to strip the string until only 'filename'
GA> is left
GA> I'm a bit new at eregi stuff

GA> any help would be appreciated
GA> many thanks

GA> g


I do this:
$file = '/folder/folder/Library/php/filename.php';
$ext = @substr($file, (@strrpos($file, ".") ? @strrpos($file, ".") + 1 : @strlen($file)), @strlen($file));
$fname = basename($file,$ext);

--
regards,
Tom

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация