$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
启科网络商城系统由启科网络技术开发团队完全自主开发,使用国内最流行高效的PHP程序语言,并用小巧的MySql作为数据库服务器,并且使用Smarty引擎来分离网站程序与前端设计代码,让建立的网站可以自由制作个性化的页面。 系统使用标签作为数据调用格式,网站前台开发人员只要简单学习系统标签功能和使用方法,将标签设置在制作的HTML模板中进行对网站数据、内容、信息等的调用,即可建设出美观、个性的网站。
0
立即学习“PHP免费学习笔记(深入)”;
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号