一、PHP获取域名地址
$host = $_SERVER['HTTP_HOST'];
二、PHP获取域名后面的所有字符
$host = $_SERVER['REQUEST_URI'];//https://www.baidu.com/md/?articleId=134157878//输出 /md/?articleId=134157878
三、PHP获取服务器的IP
$serverIP = $_SERVER['SERVER_ADDR'];
echo "服务器IP地址是:" . $serverIP;
//服务器IP地址是:103.40.21.106
四、PHP获取http请求还是https请求
$http_type = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' : 'http://';