Test code
$c
//echo $content;
$ft=array ("
","");
//echo count($ft);
$html = "abaaaaaaa
csssssssssssssssssd
efdddddddddddddddd";
preg_match_all ("|(
)|U",$html,$out, PREG_PATTERN_ORDER);
while (list($key,$value) = each($out[1])) {
}
$keywords = preg_split ("/(
)/", $html);
//echo $html;
$pagesize=10;
$size=0;
$h="";
for ($i=0; $i< count($keywords); $i++) {
if($size<$pagesize){
$size+=strlen($keywords[$i]);
// echo "size= ".$size;
$h.=$keywords[$i];
}
}
echo $h;
?>
The idea is to use
to decompose the article content into multiple blocks to form The array
then iterates through the example, and at the same time combines the article content blocks bit by bit until its length is greater than $pagesize
This is a good method. Use regular preg_split to divide the article content, taking into account that in the future, not only use < br /> Use or more delimiters at the same time
But the problem is that after using multiple delimiters at the same time, it is impossible to determine which delimiter a certain paragraph is divided according to. The article content cannot be completely restored
The project is relatively tight, and the editor for adding articles is fckeditor. Each article has n number of . I will not consider multiple separators for the time being. So it is not a complete solution.
The above introduces the incomplete solution of automatic paging in Solution Explorer, including the content of Solution Explorer. I hope it will be helpful to friends who are interested in PHP tutorials.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn