一直安静

子曰:富而可求也,虽执鞭之士,吾亦为之;如不可求,从吾所好。

PHP正则表达式,从网址(url)中取得域名

[ At 2008-6-6 By 一直安静   1 comments ]
以下代码可以从URL中获得域名例如:http://yyoo.cn/live/q.html得到yyoo.cnfunction get_domain($url){  $pattern = "/[\w-]+\.(com|net|org|gov|cc|biz|info|cn)(\.(cn|hk))*/";  preg_match($pattern, $url, $matches);  if(count($matches) > 0) { &...Read More...
分页:[<<][1][>>]

Powered By Z-Blog 1.6 Final Build 60816

Copyright 一直很安静 Some Rights Reserved. © 2004-2009