PHP is simple to implement the paging function of text files
PHP is simple to implement the paging function of text files
<title>Paging</title>
Php//Chinese character handlingfunctionM_SUBSTR ($str,$start,$length){ $str _length=$start+$length;//get total intercept length $tmp _str= ""; for($i= 0;$i<$str _length;$i++){ if(Ord(substr($str,$i, 1)) = = 0x0a){ $tmp _str.= "
"; } if(Ord(substr($str,$i, 1)) >0xa0){ $tmp _str.=substr($str,$i, 2); $i++; }Else{ $tmp _str.=substr($str,$i, 1); } } return $tmp _str;}//pass-through parameter processingif(isset($_get[' Page '])){ $page=$_get[' Page '];}Else{ $page= 1;}$counter=file_get_contents("Example.txt");$length=strlen($counter);$page _count=Ceil($length/400);$pre _str= M_substr ($counter, 0, ($page-1) *400);$now _str= M_substr ($counter, 0,$page*400);Echo substr($now _str,strlen($pre _str),strlen($now _str)-strlen($pre _str));Echo"
";EchoThe current page.$page." /".$page _count;Echo"Index";if($page>1){ Echo"$page-1). "' >pre ";}if($page<$page _count){ Echo"$page+1). " >next ";}Echo"$page _count>end ";?>