1.php超长文本分页.运用自定义函数unhtml
代码:
if ($page=="") {$page=1;}; //判断变量的值是否为空
include("function.php");//调用指定的包含文件,即自定义函数
?>
codego.net
| codego.net | |
|
if($page){ $counter=file_get_contents("file/file.txt"); $length=strlen(unhtml($counter)); $page_count=ceil($length/1050); $c=msubstr($counter,0,($page-1)*1050); $c1=msubstr($counter,0,$page*1050); echo substr($c1,strlen($c),strlen($c1)-strlen($c)); }?> |
| |
页次:<?php echo $page;?> / <?php echo $page_count;?> 页 | 分页: if($page!=1){ echo "首页 "; echo "上一页 "; } if($page echo "下一页 "; echo "尾页"; } ?> |
__________________________________________________________________________________________
2.Ajax无刷新分页
代码:
codego.net
|
| //读取超长文本中的数据,实现超长文本中数据的分页显示 if($page){ $counter=file_get_contents("file/mr_synopsis.txt"); $length=strlen($counter); $page_count=ceil($length/950); $c=msubstr($counter,0,($page-1)*950); $c1=msubstr($counter,0,$page*950); echo substr($c1,strlen($c),strlen($c1)-strlen($c)); } ?> |
|
|