$pre_p){
$ps[(int)$pre_p[1]] = 'p';
$ps[(int)$suf_matches[0][$index][1]] = 's';
}
//对p进行排序
$sort = array_keys($ps);
asort($sort);
$count = count($pre_matches[0]);
foreach($pre_matches[0] as $index=>$pre_p){
//<p $hit <p+1 时p被命中
if(($pre_matches[0][$index][1] < $hit)
&& ($hit < $pre_matches[0][$index+1][1])){
$deeper = 0;
//弹出被命中p前的p
while(array_shift($sort) != $pre_matches[0][$index][1]
&& ($count--)) continue;
//对剩余p进行匹配,若下一个为前缀,则向下一层,$deeper加1,
//否则后退一层,$deeper减1,$deeper为0则命中匹配,计算p长度
foreach($sort as $key){
if($ps[$key] == 'p') $deeper++;
else if($deeper == 0) {
$length = $key-$pre_matches[0][$index][1];
break;
}else {
$deeper--;
}
}
$hitDivString = substr($data,$pre_matches[0][$index][1],$length).'';
break;
}
}
return $hitDivString;
}
//考虑到id单双引号符号问题,id="u"由用户自己填写。
//声明:此段php只针对带 id p内容的读取。
echo getWebDiv('id="taglist"','http://www.cnblogs.com/Zjmainstay/tag/');
//End_php
$pre_p){
$ps[(int)$pre_p[1]] = 'p';
$ps[(int)$suf_matches[0][$index][1]] = 's';
}
//对p进行排序
$sort = array_keys($ps);
asort($sort);
$count = count($pre_matches[0]);
foreach($pre_matches[0] as $index=>$pre_p){
//<p $hit <p+1 时p被命中
if(($pre_matches[0][$index][1] < $hit) && ($hit < $pre_matches[0][$index+1][1])){
$deeper = 0;
//弹出被命中p前的p
while(array_shift($sort) != $pre_matches[0][$index][1] && ($count--)) continue;
//对剩余p进行匹配,若下一个为前缀,则向下一层,$deeper加1,
//否则后退一层,$deeper减1,$deeper为0则命中匹配,计算p长度
foreach($sort as $key){
if($ps[$key] == 'p') $deeper++;
else if($deeper == 0) {
$length = $key-$pre_matches[0][$index][1];
break;
}else {
$deeper--;
}
}
$hitDivString = substr($data,$pre_matches[0][$index][1],$length).'';
break;
}
}
return $hitDivString;
}
echo getWebTag('id="nav"','http://mail.163.com/html/mail_intro/','ul');
echo getWebTag('id="homeBanners"','http://mail.163.com/html/mail_intro/');
echo getWebTag('id="performance"','http://mail.163.com/html/mail_intro/','section');
//End_php
系统简介逍遥内容管理系统(CarefreeCMS)是一款功能强大、易于使用的内容管理平台,采用前后端分离架构,支持静态页面生成,适用于个人博客、企业网站、新闻媒体等各类内容发布场景。核心特性1、模板套装系统 - 支持多套模板自由切换,快速定制网站风格2、静态页面生成 - 一键生成纯静态HTML页面,访问速度快,SEO友好3、文章管理 - 支持富文本编辑、草稿保存、文章属性标记、自动提取SEO4、全
1
立即学习“PHP免费学习笔记(深入)”;
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号