<?php
// 从 URL 中取得主机名
preg_match(
"/^(http://)?([^/]+)/i"
,
"http://yuncode.net/index.html"
$matches
);
$host
=
[2];
// 从主机名中取得后面两段
"/[^./]+.[^./]+$/"
echo
"域名为:{$matches[0]}"
;
?>