<?Php
$delimiter = "<hr />";
$strArr = array();
$page = isset($_GET['page']) ? intval($_GET['page']) : 0;
$strArr = explode($delimiter,$newsCon);
$strNum = count($strArr);
$content = $strArr[$page];
?>
<?php echo $content; ?>
<!-- 文章内容分页控制区BEGIN -->
<?php
if ($strNum > 1) {
for ($n = 0; $n < $strNum; $n++)
{
if($page==$n){
echo "<span>".($n+1)."</span>";
}else{
echo "<a href='?page=$n'>".($n+1)."</a>";
}
}
}
?>
<!-- 文章内容分页控制区END-->
<div class="page"> <div class="pager"><div style='width:100%;height:30px;line-height:30px;text-align:center;'><span class=color>共:<?=$strNum?>页 <a href='?id=<?=$id?>&page=0'>第一页</a> |
<?php if ($page>0){ ?>
<a href='?id=<?=$id?>&page=<?=$page-1?>'>上一页</a>
<?php }else{ ?>
上一页
<?php } ?>
|
<?php if ($page>=$strNum-1){ ?>
下一页
<?php }else{ ?>
<a href='?id=<?=$id?>&page=<?=$page+1?>'>下一页</a>
<?php } ?>
| <a href='?id=<?=$id?>&page=<?=$strNum-1?>'>尾页</a>
</div>
</div>
</div>
转载于:https://blog.51cto.com/wangliwen/1434414