文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>正则表达式例子:获得某个网页上的所有超裢接

正则表达式例子:获得某个网页上的所有超裢接

时间:2007-02-18  来源:PHP爱好者

CODE:
[复制到剪切板]
<html>
<head><title>正则表达式</title></head>
<body>
<a href="./">返回列表</a><br><form action="<?echo $PHP_SELF;?>" method="post">
URL:<input type="text" name="url" value="<?echo $url?>"><input type="submit" value="获取所有裢接">
</form>
<?
if(isset($url)){
    echo "$url 有下列裢接:<br>";
    $fcontents = file($url);
    while(list(,$line)=each($fcontents)){
        while(eregi((href[[:space:]]*=[[:space:]]*"?[[:alnum:]:@/._-]+"?)(.*),$line,$regs)){
            $regs[1] = eregi_replace((href[[:space:]]*=[[:space:]]*"?)([[:alnum:]:@/._-]+)("?),"2",$regs[1]);
            echo "    $regs[1]<br>";
            $line = $regs[2];
        }
    }
}
?>
</body>
</html>  php爱好者站 http://www.phpfans.net PHP|MySQL|javascript|ajax|html.
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载