PHP URL CURRENT

From CoderLearner
Jump to: navigation, search

PHP URL CURRENT

Get current URL. It returns the path and the file name of the URL.

Example

The $_SERVER['PHP_SELF'] and $_SERVER['SCRIPT_NAME'] return the same result.

<?php
echo $_SERVER['PHP_SELF'];
echo "<br/>";
echo $_SERVER['SCRIPT_NAME'];
echo "<br/>";
?>

Output

/goheme/index.php
/goheme/index.php