- function match_links($document) {
- preg_match_all("'<s*as.*?hrefs*=s*(["'])?(?(1)(.*?)1|([^s>]+))[^>]*>?(.*?)</a>'isx",$document,$links);
- while(list($key,$val) = each($links[2])) {
- if(!emptyempty($val))
- $match['link'][] = $val;
- }
- while(list($key,$val) = each($links[3])) {
- if(!emptyempty($val))
- $match['link'][] = $val;
- }
- while(list($key,$val) = each($links[4])) {
- if(!emptyempty($val))
- $match['content'][] = $val;
- }
- while(list($key,$val) = each($links[0])) {
- if(!emptyempty($val))
- $match['all'][] = $val;
- }
- return $match;
- }
- <?php
- echo preg_replace("/(?<=href=)([^>]*)(?=>)/i","#", "<a href='www.phpfensi.com'>你好,点这里看看</a><a href='www.phpfensi.com'>你好,点这里看看</a>");
- ?>
posted @
2021-08-18 09:35
v17166570219
阅读(
454)
评论()
收藏
举报