醉菜鸟 2021-08-09 22:48:23

PHP 获取当前请求的host

/**
* 当前请求的host
* @return string
*/
function host()
{
return $_SERVER['HTTP_X_REAL_HOST'] ?: $_SERVER['HTTP_HOST'];
}
意见反馈