<?php preg_match('/[^.]+\.[^.]+$/', $_SERVER['HTTP_HOST'], $matches);//获取根域名(仅支持如www.baidu.com,不支持www.techweb.com.cn) $domain = $matches[0];
获取根域名(仅支持如www.baidu.com,不支持www.techweb.com.cn)