static public function GetRootDomain($domain=null) 
	{
	    $domain = !empty($domain) ? $domain : (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : null);
	    if (!$domain) {
	        return 'localhost';
	    }
	    
	    $re_domain = '';
	    $domain_postfix_cn_array = array("com", "net", "org", "gov", "edu", "com.cn", "net.cn", "cn");
	    $array_domain = explode(".", $domain);
	    $array_num = count($array_domain) - 1;
	    if ($array_domain[$array_num] == 'cn') {
	        if (in_array($array_domain[$array_num - 1], $domain_postfix_cn_array)) {
	            $re_domain = $array_domain[$array_num - 2] . "." . $array_domain[$array_num - 1] . "." . $array_domain[$array_num];
	        } else {
	            $re_domain = $array_domain[$array_num - 1] . "." . $array_domain[$array_num];
	        }
	    } else {
	        $re_domain = $array_domain[$array_num - 1] . "." . $array_domain[$array_num];
	    }
	    return $re_domain;
	}
static public function GetRootDomain($domain=null) 
	{
	    $domain = !empty($domain) ? $domain : (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : null);
	    if (!$domain) {
	        return 'localhost';
	    }
	    
	    $re_domain = '';
	    $domain_postfix_cn_array = array("com", "net", "org", "gov", "edu", "com.cn", "net.cn", "cn");
	    $array_domain = explode(".", $domain);
	    $array_num = count($array_domain) - 1;
	    if ($array_domain[$array_num] == 'cn') {
	        if (in_array($array_domain[$array_num - 1], $domain_postfix_cn_array)) {
	            $re_domain = $array_domain[$array_num - 2] . "." . $array_domain[$array_num - 1] . "." . $array_domain[$array_num];
	        } else {
	            $re_domain = $array_domain[$array_num - 1] . "." . $array_domain[$array_num];
	        }
	    } else {
	        $re_domain = $array_domain[$array_num - 1] . "." . $array_domain[$array_num];
	    }
	    return $re_domain;
	}
static public function GetRootDomain ( $ domain = null ) { $ domain = ! empty ( $ domain ) ? $ domain : ( isset ( $ _SERVER [ 'HTTP_HOST' ] ) ? $ _SERVER [ 'HTTP_HOST' ] : null ) ; if ( ! $ domain ) { return 'localhost' ; } $ re_domain = '' ; $ domain_postfix_cn_array = array ( "com" , "net" , "org" , "gov" , "edu" , "com.cn" , "net.cn" , "cn" ) ; $ array_domain = explode ( "." , $ domain ) ; $ array_num = count ( $ array_domain ) - 1 ; if ( $ array_domain [ $ array_num ] == 'cn' ) { if ( in_array ( $ array_domain [ $ array_num - 1 ] , $ domain_postfix_cn_array ) ) { $ re_domain = $ array_domain [ $ array_num - 2 ] . "." . $ array_domain [ $ array_num - 1 ] . "." . $ array_domain [ $ array_num ] ; } else { $ re_domain = $ array_domain [ $ array_num - 1 ] . "." . $ array_domain [ $ array_num ] ; } } else { $ re_domain = $ array_domain [ $ array_num - 1 ] . "." . $ array_domain [ $ array_num ] ; } return $ re_domain ; }
get root domain
@param  string $domain
@return string
get root domain