PHP obtains several global variables of the domain name

WBOY
Release: 2016-07-25 08:57:28
Original
1029 people have browsed it
  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


source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!