大家好,请教一个问题,在html代码中找出所有的url并替换成我要的url格式。
比如<html>
<head>ssss</head>
<body>
<a href="http://www.ddd1.com" target="_blank">dsafsdfsdfsdfsf</>
<a href="http://www.dsdafsdd.com/dd.aspx?ddds=1" target="_blank">dsafdfsf</>
<a href="http://www.ddsdafdfd.com/ddssfddd.aspx?ddds=2" target="_blank">dsafsdfsdafsdfasdfsdfsdfsf</>
<body>
</html>
能否找上面代码中的所有url并把url加密然后替换成下面的形式
<html>
<head>ssss</head>
<body>
<a href="goto.aspx?url=aa" target="_blank">dsafsdfsdfsdfsf</>说明aa为http://www.ddd1.com加密后的字符串
<a href="goto.aspx?url=bb" target="_blank">dsafdfsf</>说明bb为http://www.dsdafsdd.com/dd.aspx?ddds=1加密后的字符串
<a href="goto.aspx?url=cc" target="_blank">dsafsdfsdafsdfasdfsdfsdfsf</>说明cc为http://www.ddsdafdfd.com/ddssfddd.aspx?ddds=2加密后的字符串
<body>
</html>希望大家能够指点。
比如<html>
<head>ssss</head>
<body>
<a href="http://www.ddd1.com" target="_blank">dsafsdfsdfsdfsf</>
<a href="http://www.dsdafsdd.com/dd.aspx?ddds=1" target="_blank">dsafdfsf</>
<a href="http://www.ddsdafdfd.com/ddssfddd.aspx?ddds=2" target="_blank">dsafsdfsdafsdfasdfsdfsdfsf</>
<body>
</html>
能否找上面代码中的所有url并把url加密然后替换成下面的形式
<html>
<head>ssss</head>
<body>
<a href="goto.aspx?url=aa" target="_blank">dsafsdfsdfsdfsf</>说明aa为http://www.ddd1.com加密后的字符串
<a href="goto.aspx?url=bb" target="_blank">dsafdfsf</>说明bb为http://www.dsdafsdd.com/dd.aspx?ddds=1加密后的字符串
<a href="goto.aspx?url=cc" target="_blank">dsafsdfsdafsdfasdfsdfsdfsf</>说明cc为http://www.ddsdafdfd.com/ddssfddd.aspx?ddds=2加密后的字符串
<body>
</html>希望大家能够指点。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货