php超长文本的分页
来源:互联网 发布:cf刷枪软件2016 编辑:程序博客网 时间:2024/04/30 12:02
index.php代码:
<?php session_start(); if ($page=="") {$page=1;};?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>超长文本的分页显示</title>
<style type="text/css">
<!--
.STYLE1 {font-size: 12px}
.STYLE2 {font-size: 13px}
-->
</style>
</head>
<body>
<table width="450" height="285" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="center"> </td>
<td height="50" align="center"><strong>超长文本的分页显示</strong></td>
<td align="center"> </td>
</tr>
<tr>
<td width="97" align="left" valign="middle"> </td>
<td width="270" align="left" valign="middle"><span class="STYLE2">
<?php
if($page){
$fp=fopen("file/file.txt","r");
$counter=fgets($fp);
$length=strlen($counter);
$page_count=ceil($length/200);
$fp=fopen("file/file.txt","r");
include("function.php");
$c=msubstr($counter,0,($page-1)*200);
$c1=msubstr($counter,0,$page*200);
echo substr($c1,strlen($c),strlen($c1)-strlen($c));
}?>
</span></td>
<td width="75" align="left" valign="middle"> </td>
</tr>
<tr>
<td height="30" align="center"> </td>
<td height="30" align="center"><table width="270" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="42%" align="center" valign="middle"><span class="STYLE1"> 页次:<?php echo $page;?> / <?php echo $page_count;?> 页 </span></td>
<td width="58%" height="28" align="left" valign="middle"><span class="STYLE1"> 分页:
<?php
if($page!=1){
echo "<a href=index.php?page=1>首页</a> ";
echo "<a href=index.php?page=".($page-1).">上一页</a> ";
}
if($page<$page_count){
echo "<a href=index.php?page=".($page+1).">下一页</a> ";
echo "<a href=index.php?page=".$page_count.">尾页</a>";
}
?>
</span> </td>
</tr>
</table></td>
<td height="30" align="center"> </td>
</tr>
<tr>
<td height="35" colspan="3" align="center"> </td>
</tr>
</table>
</body>
</html>
function.php 代码:
<?php
function msubstr($str,$start,$len){
$strlen=$start+$len;
for($i=0;$i<$strlen;$i++) {
if(ord(substr($str,$i,1))>0xa0) {
$tmpstr.=substr($str,$i,2);
$i++;
}else{
$tmpstr.=substr($str,$i,1); }
}
return $tmpstr;
}
?>
- php超长文本的分页
- 超长文本分页
- 实现超长文本分页显示
- 实现超长文本分页显示
- 超长字符的分页显示
- 超长字符的智能分页-支持HTM
- 超长字符的智能分页-支持HTML
- 超长字符的智能分页-支持HTML
- 一个可分页的基于文本的PHP留言板
- 文本超长处理
- C++切分超长文本
- 超长字符串分页
- Wp7中TextBlock超长Text文本的正确显示
- CSS 超长文本的隐藏和鼠标覆盖后显示
- jsp实现新闻内容或超长文章的分页
- 电子书中超长字符串(章节内容)分页的算法
- 分页的文本显示
- PHP实现分页:文本分页和数字分页
- MyEclipse 8.5 安装配置指南
- UVaOJ
- 融入电商大潮的八条靠谱建议
- 谈谈我网络分层协议的理解和问题
- huawei交换机典型配置
- php超长文本的分页
- 求AOE网的关键路径
- java之线程thread生命周期
- 什么是爱
- bonjour简单使用心得
- [Google] 字符串中求最长的子串,该子串最多只含有2个不同的字符
- 【淘宝客服的制胜法宝:投诉处理篇】
- 二叉树的深度优先遍历与广度优先遍历 [C++实现]
- Ubuntu下jsp建站教程 Tomcat MyEclipse Maven Struts2 80端口