Christopher Juckins

SysAdmin Tips, Tricks and other Software Tools

User Tools

Site Tools


php_tricks

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
php_tricks [2015/10/24 22:33] juckinsphp_tricks [2016/07/20 16:56] juckins
Line 1: Line 1:
-# the entire URL of the current page, including query string \\ +$actual_link 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']; 
-$url = $_SERVER['REQUEST_URI']; +echo "Our URL: $actual_link<br><br>\n";
  
-# the base URL of the current page without query string \\+ # the entire URL of the current page, including query string 
 +$url = $_SERVER['REQUEST_URI']; 
 +echo "\$_SERVER['REQUEST_URI'] ---> $url<br><br>\n"; 
 + 
 +# the base URL of the current page without query string
 $url_base = $_SERVER['PHP_SELF']; $url_base = $_SERVER['PHP_SELF'];
 +echo "\$_SERVER['PHP_SELF'] ---> $url_base<br><br>\n";
  
-# The web host \\+# The web host
 $host = $_SERVER['HTTP_HOST']; $host = $_SERVER['HTTP_HOST'];
 +echo "\$_SERVER['HTTP_HOST'] ---> $host<br><br>\n";
  
-# Just the path of the URL without the filename \\+# Just the path of the URL without the filename
 $path = substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], '/') + 1); $path = substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], '/') + 1);
 +echo "Path of the URL without the filename ---> $path<br>\n";
 +
  
 More info on parsing the URL: http://php.net/manual/en/function.parse-url.php  More info on parsing the URL: http://php.net/manual/en/function.parse-url.php 
 +
php_tricks.txt · Last modified: 2018/11/01 21:32 by juckins