Saturday, October 25, 2008

Self-Referencing

In the Web application often we need self referencing URL to refer path current Script. Marginally this implementation step can through 2 approach, namely apply superglobal $_ SERVER and function getenv().

echo $_SERVER['PHP_SELF']; echo $_SERVER['SCRIPT_NAME']; echo $_SERVER['REQUEST_URL'] echo getenv['SCRIPT_NAME'] echo getenv['REQUEST_URL']
Different with other element, REQUEST_URL will return query string (if founded. For applied inveterate approach is element PHP_SELF.

0 comments:

Post a Comment