时间:2021-07-01 10:21:17 帮助过:41人阅读
Dim a%, b%, s$, sok$ Dim HtmlFile As String HtmlFile = "C:\vb.htm" sok = "" Web1.Navigate(HtmlFile) For Each o In Web1.Document.GetElementsByTagName("div") If InStr(o.innerHTML, "txtmod") > 0 Then s = o.innerHTML a = InStr(o.innerHTML, "txtmod") b = InStr(o.innerHTML, "subContent") sok = Mid(s, a - 1, b - a) sok = Replace(sok, "=txtmod>", "") sok = Replace(sok, "
回复讨论(解决方案)
$s = file_get_contents('t1.html');preg_match('/txtmod(.+?)subContent/is',$s,$m);file_put_contents('t2.html',$m[1]);
t1.html里面的内容是csdn论坛首页的内容,在里面加了 txtmod和 subContent,在导航栏的开头和结尾
t2.html里面是匹配到的导航栏 php 功能就是强大可能不用安装桌面软件来