看图片


盖楼功能不会影响数据库中的内容,只是显示时,将其优化一下而已,操作数据不影响。
测试帖子地址:
http://www.youyax.com/forum/Content-index-id-4261.shtml
实现代码:
$result_data=array();
foreach($results as $v){
$num=preg_match_all("/<fieldset/",$v['content1'],$tmp);
if($num>5){
$v['content1']=preg_replace("/(<fieldset[^<]+<legend>[^<]+<\/legend>\s*)(<fieldset[^<]+<legend>[^<]+<\/legend>\s*)(<fieldset[^<]+<legend>[^<]+<\/legend>\s*)(<fieldset[^<]+<legend>[^<]+<\/legend>\s*)(<fieldset[^<]+<legend>[^<]+<\/legend>\s*){1,}(<fieldset[^<]+<legend>[^<]+<\/legend>[^<]+)(<\/fieldset>[^<]+)(<\/fieldset>[^<]+){1,}(<\/fieldset>[^<]+)(<\/fieldset>[^<]+)(<\/fieldset>[^<]+)(<\/fieldset>)/is","\\1\\2\\3\\4<span style=\"color:#388600;position:relative;top:8px;left:10px;\">部分楼层已被隐藏</span>\\6\\8\\9\\10\\11\\12",$v['content1']);
}
$result_data[]=$v;
}
$this ->assign('data1', $result_data);
PS:这段实现的代码自己本来还不会,


共同进步~
------解决方案--------------------
共同进步


------解决方案--------------------
功能不错,美化一下视觉效果更好!