Home  >  Article  >  Backend Development  >  Parse PHP to obtain the implementation code of the current URL and domain name_PHP tutorial

Parse PHP to obtain the implementation code of the current URL and domain name_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:04:37780browse

Copy code The code is as follows:

//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 current The suffix of the 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
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327754.htmlTechArticleCopy the code as follows: ? //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"]; $_SERVE...
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