.*? #标签内容
(?1)> #结束标签
;x
heredoc
, $s, $matches, preg_offset_capture, $o);
if ( $is_match ) {
foreach ( $matches[0] as $match ) {
$o0 = $match[1];
#标签左边界越过截取目标右边界, 退出
if ( $o0 >= $o + $l ) break;
$l0 = strlen($match[0]);
#标签右边界在截取目标右边界内, 继续
if ( $o0 + $l0
#以下为标签跨边界处理
$l = $o0 + $l0 - $o;
break;
}
}
return substr($s, $o, $l);
}
echo $str . chr(10);
echo substr_remain_tag($str, 0, 20) . chr(10);
http://www.bkjia.com/phpjc/326438.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/326438.htmltecharticle复制代码 代码如下: ?php /** * author: goosman * blog: http://blog.csdn.net/lgg201 * mail: lgg860911@yahoo.com.cn */ $str = '0123456789a012/a0123456789'; function substr_rem...
