Get Host domain name function

Source: Internet
Author: User
search, I want to use, paste it out, look at the wood has a problem ah!
Echo $HTTP _host
is the domain name to output!
  1. function pma_getenv ($var _name) {
  2. if (isset ($_server [$var _name]) {
  3. return $_server [$var _name];
  4. } elseif (Isset ($_env [$var _name]) {
  5. return $_env [$var _name];
  6. } elseif (getenv ($var _name)) {
  7. return getenv ($var _name);
  8. } elseif (function_exists (' apache_getenv ') && apache_getenv ($var _name, True) {
  9. return Apach E_getenv ($var _name, true);
  10. }
  11. return ';
  12. }
  13. if (empty ($HTTP _host)) {
  14. if (pma_getenv (' Http_host ')) {
  15. $HTTP _host = Pma_g Etenv (' Http_host ');
  16. } else {
  17. $HTTP _host = ';
  18. }
  19. }
  20. echo htmlspecialchars ($HTTP _host);
copy code
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.