Home >Backend Development >PHP Tutorial >PHP obtains several global variables of the domain name

PHP obtains several global variables of the domain name

WBOY
WBOYOriginal
2016-07-25 08:57:281049browse
  1. //Get the current domain name:
  2. echo $_SERVER['SERVER_NAME'];//Get the source URL, that is, click to go to the previous page URL of this page
  3. echo "
    ";
  4. echo $_SERVER["HTTP_REFERER"]; //Get the suffix of the previous page domain name
  5. echo "
    ";
  6. echo $_SERVER['REQUEST_URI'];//Get the suffix of the current domain name
  7. echo "
    ";
  8. echo $_SERVER['HTTP_HOST'];//Get the current domain name
  9. echo "
    "; //bbs.it-home.org
  10. dirname(__FILE__);//Get the current file The physical path
  11. dirname(__FILE__)."/../";//Get the upper-level physical path of the current file
  12. exit;
  13. ?>
Copy code


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