// 从 URL 中取得主机名
preg_match("/^(http:)?([^//]+)/i","http://database.youkuaiyun.com/", $matches);
$host = $matches[2];
// 从主机名中取得后面两段
preg_match("/[^/.//]+/.[^/.//]+$/", $host, $matches);
echo "domain name is: {$matches[0]}/n";
从 URL 中取得主机名
最新推荐文章于 2023-12-19 16:33:09 发布