How to get url of current page using php

Possible duplicate:
How to get the current full page URL in PHP

How can I get the url of the current page using php? Is there such a php function?

What I want to achieve:

  • Somehow get the url of the current page
  • check if the url is equal to some preset value
  • if equal, then echo something else echo something else
+3
source share
1 answer
<?php
    $url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    echo $url;
?>
+11
source

All Articles