Reading URL in php

This question already has an answer here:

  • Get the full URL in PHP 28 answers

  • The thing you want is Subdomain of your url. Use this

    $subdomain =  array_shift(explode(".",$_SERVER['HTTP_HOST']));
    

    $domain = $_SERVER['HTTP_HOST'];
    $path = $_SERVER['SCRIPT_NAME'];
    $queryString = $_SERVER['QUERY_STRING'];
    $url = "http://" . $domain . $path . "?" . $queryString;
    echo "The current URL is: " . $url . "";
    
    visit :http://www.2basetechnologies.com/
    
    链接地址: http://www.djcxy.com/p/42286.html

    上一篇: 如何在shopify联系表单中捕获网站网址

    下一篇: 在php中读取URL