官方代码
$domain = $domain=='localhost'?'localhost':'www'.strstr($_SERVER['HTTP_HOST'],'.');更改为$urls = explode('.', $_SERVER['HTTP_HOST']);
$domain = $domain=='localhost'?'localhost': (count($urls)>=3?strstr($_SERVER['HTTP_HOST'],'.'):'www.'.$_SERVER['HTTP_HOST']);
就解决了根域生成二级域名了,。
还有没有更好的方法?? 最佳答案