Re: URL Parsing...

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

 



Richard Heyes wrote:
>> one of these should give you something to go on:
>>
>> echo preg_replace('\.cfm$', '-meta.cfm',
>> parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)), "\n";
>> echo preg_replace('\.cfm$', '-meta.cfm', $_SERVER['PATH_TRANSLATED']),
>> "\n";
>> echo preg_replace('\.cfm$', '-meta.cfm', $_SERVER['SCRIPT_FILENAME']),
>> "\n";
>>
>>> Anything would be helpful.  :)
> 
> You don't need the overhead of PCRE, though it is the fastest to write,
> since it's already above for you...

well if you take a string (filename) and wish to change the end of it somone
then I don't think str_replace() is the correct function. what's to say a script
doesn't exist called 'my.cfm.php'?

> 
> Or parse_url(). basename(__FILE__) will get you the filename.

ah yes basename() - I forgot to put use that in the examples, good catch.

> 

-- 
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