联系官方销售客服
1835022288
028-61286886
截取当前域名的前缀
<?php $domain = $_SERVER['HTTP_HOST']; if (strpos($domain, 'https://') > -1 || strpos($domain, 'http://') > -1) { $arr1 = explode('//', $domain); $domain = $arr1[1]; } $arr2 = explode('.', $domain); unset($arr2[count($arr2) - 1]); unset($arr2[count($arr2) - 1]); $sub_domain = implode('.', $arr2); ?>
www.baidu.com 截取 www
1.2.baidu.com 截取1.2