PHP: get relevant URL of the current page using $_SERVER array

Опубликовано: 01 Апрель 2013
на канале: Jiansen Lu
1,166
2

$_SERVER array in PHP stores server and execution environment information.
In PHP project development, we often need to get some of the relevant URL of the current page using $_SERVER array.
More code:
http://jiansenlu.blogspot.ca/2013/03/...
Note:
difference between $_SERVER['SERVER_NAME'] and $_SERVER['HTTP_HOST']
For: http://localhost:8083
$_SERVER['SERVER_NAME'] returns localhost, while $_SERVER['HTTP_HOST'] returns localhost:8083.