Home >Backend Development >PHP Tutorial >PHP gets the current URL domain name_PHP tutorial
//Get the current domain name:
echo SERVER['SERVER_NAME'];//Get the source URL, that is, click to go to the previous page URL of this page
echo SERVER["HTTP_REFERER"];
SERVER['REQUEST_URI'];//Get the suffix of the current domain name
SERVER['HTTP_HOST'];//Get the current domain name
dirname(__FILE__);//Get the physical path of the current file
dirname(__FILE__)."/../";//Get the upper-level physical path of the current file
?>
Excerpted from Hurry’s column