Home >Backend Development >PHP Tutorial >PHP gets the current URL domain name_PHP tutorial

PHP gets the current URL domain name_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:48:091024browse


//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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478447.htmlTechArticle/prepre class=php name=code? //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_UR...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn