时间:2021-07-01 10:21:17 帮助过:11人阅读
- $str = file_get_contents("http://www.nhdali.com/zsxx/news02.php");
- $match = "/<strong>]*?>(.*?)<.*?em>(.*?)<\/em>.*?<small>([^<]*?)<font color="#e78608">------解决方案--------------------</font><br>估计写完这个内容匹配,还要写每个具体的信息的标题、内容、url解析吧!<br><br>这个用dom+xpath比你分析一遍然后再分析一遍要好的多!<br><br>另外推荐下4楼得正则,把你要的所有内容都找到了!
- <br><font color="#e78608">------解决方案--------------------</font><br><fieldset><legend>探讨</legend><br><br>想问一下 三楼 和四楼, 正则最后的iUs 是什么意思, i 是不区分大小写,其他的我不知道了!<br></fieldset>
- <br><font color="#e78608">------解决方案--------------------</font><br><fieldset><legend>探讨</legend><br><br>引用:<br><br>想问一下 三楼 和四楼, 正则最后的iUs 是什么意思, i 是不区分大小写,其他的我不知道了!<br><br><br>u是按照unicode编码, s是.可以代表任意空白字符<br></fieldset>
- <br><font color="#e78608">------解决方案--------------------</font><br>$str_pre='/\s*<span>\s*<strong>(.*?)<\/a>(.*?)\s*<em>(.*?)<\/em>\s*<\/span>\s*<small>(([\w\W]*?)|(.*?))<\/small>/';<br>用这个可以匹配到! </small></em></strong></span></small></strong>