You are here: Re: $HTTP_SERVER_VARS['REQUEST_URI'] - help needed « All PHP « IT news, forums, messages
Re: $HTTP_SERVER_VARS['REQUEST_URI'] - help needed

Posted by -Lost on 06/08/06 08:00

> If I use this ""<?php echo $HTTP_SERVER_VARS['REQUEST_URI']; ?> I get a backslash
> berfore the URL.

> For example: I get this URL returned "/content" if the url requested is
> "www.domain/content". Is there a setting I can use to avoid the backslash ?

That is the REQUEST_URI. Everything *after* the domain.

Now, it depends on how much you need after the domain. For example, do you need just the
name of the file executing the script? Do you need everything after the domain, just
minus the first backslash?

You could try:

print basename($_SERVER['REQUEST_URI']);
// *OR*, PHP_SELF, SCRIPT_NAME, SCRIPT_FILENAME

print trim($_SERVER['REQUEST_URI'], '/');

Not to mention, you should use $_SERVER as it is more robust. The former cannot be used
privately without a global declaration.

-Lost

 

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

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