PHP根据URL提取主域名,在网上荡了一个!
优化了一下域名库,支持了PHP7.0!
可以直接拿来用,测试了一下没发现问题!
<?...getBaseDomain('http://51.ca/index.php','domain');echo "\n";
echo getBaseDomain('https://blog.ab.cc.win.aisa.hk...to','tc','tt','tn','tv','tr','tm','tk','wf','vu','gt','ve','bn','ug','ua','uy','uz','es','eh','gr','hk...','coffee','com.co','com.hk','com.tw','company','cool','credit','cricket','date','design','dev','diet...','org.cn'
);
if(!